bos_cart_get
Retrieves the current user's shopping cart from the BOS ERP system. Use this to view cart contents for order processing.
Instructions
Get current user cart
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "bos_cart_get"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/bos.ts:219-219 (handler)The handler function for bos_cart_get - makes a GET request to /mcp/cart endpoint
handler: async (_, client) => client.get('/mcp/cart'), - src/tools/bos.ts:218-218 (schema)The schema for bos_cart_get - empty object (no parameters required)
schema: {}, - src/tools/bos.ts:215-220 (registration)Registration of bos_cart_get as part of cartTools array in bos.ts
{ name: 'bos_cart_get', description: 'Get current user cart', schema: {}, handler: async (_, client) => client.get('/mcp/cart'), }, - src/tools/index.ts:21-62 (helper)Helper function toZodSchema that converts tool schemas to Zod schemas for MCP SDK registration
export function toZodSchema(schema: Record<string, any>): z.ZodObject<any> { const shape: Record<string, z.ZodTypeAny> = {}; for (const [key, def] of Object.entries(schema)) { let field: z.ZodTypeAny; switch (def.type) { case 'number': field = z.number(); break; case 'boolean': field = z.boolean(); break; case 'array': field = z.array(z.any()); break; case 'object': field = z.record(z.any()); break; case 'string': default: if (def.enum) { field = z.enum(def.enum); } else { field = z.string(); } break; } if (def.description) { field = field.describe(def.description); } if (def.optional) { field = field.optional(); } shape[key] = field; } return z.object(shape); } - src/http.ts:55-75 (registration)Registration loop in HTTP server that registers all tools (including bos_cart_get) with the MCP server
for (const tool of allTools) { const zodSchema = toZodSchema(tool.schema); server.tool( tool.name, tool.description, zodSchema.shape, async (args: any) => { try { const result = await tool.handler(args, client); return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }], }; } catch (error: any) { return { content: [{ type: 'text' as const, text: JSON.stringify({ error: error.message || 'Unknown error' }) }], isError: true, }; } } ); }