const tools = busToMcpTools({
cartAdd: { description: 'Add item', target: { id: 'number' }, payload: { qty: 'number' } },
});
// → [{ name: 'cartAdd', description: 'Add item', inputSchema: {
// type: 'object',
// properties: {
// target: { type: 'object', properties: { id: { type: 'number' } }, required: ['id'] },
// payload: { type: 'object', properties: { qty: { type: 'number' } }, required: ['qty'] },
// },
// required: ['target', 'payload'],
// } }]
Convert a BusSchema into MCP tool definitions (the
tools/listshape).Mirrors
toAnthropicTools(from the schema module): each action becomes one tool, withtargetandpayloadas nested object properties. Field types map 1:1 to JSON Schema types;'any'fields get no type constraint and are excluded fromrequired(all other fields are required).