bos_order_list
Retrieve and filter orders from BOS ERP by status, date range, and pagination to manage sales workflows.
Instructions
List orders with filters
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | ||
| page_size | No | ||
| status | No | ||
| from_date | No | ||
| to_date | No |
Implementation Reference
- src/tools/bos.ts:112-113 (handler)The handler function for 'bos_order_list' that makes a GET request to '/mcp/orders' with optional query params (page, page_size, status, from_date, to_date).
handler: async (args, client) => client.get('/mcp/orders', args), }, - src/tools/bos.ts:105-111 (schema)Input schema for 'bos_order_list' defining optional filters: page, page_size, status, from_date, to_date.
schema: { page: { type: 'number', optional: true }, page_size: { type: 'number', optional: true }, status: { type: 'string', optional: true }, from_date: { type: 'string', optional: true }, to_date: { type: 'string', optional: true }, }, - src/tools/bos.ts:101-209 (registration)The tool 'bos_order_list' is defined inside the exported `orderTools` array (line 101-209), which is then spread into the main tool list in src/index.ts
export const orderTools: McpTool[] = [ { name: 'bos_order_list', description: 'List orders with filters', schema: { page: { type: 'number', optional: true }, page_size: { type: 'number', optional: true }, status: { type: 'string', optional: true }, from_date: { type: 'string', optional: true }, to_date: { type: 'string', optional: true }, }, handler: async (args, client) => client.get('/mcp/orders', args), }, { name: 'bos_order_show', description: 'Get order details by ID', schema: { order_id: { type: 'string' } }, handler: async (args, client) => client.get(`/mcp/orders/${args.order_id}`), }, { name: 'bos_order_create', description: 'Create a new order', schema: { customer_id: { type: 'string' }, items: { type: 'array', items: { type: 'object' } }, shipping_address: { type: 'object', optional: true }, payment_method: { type: 'string', optional: true }, note: { type: 'string', optional: true }, }, handler: async (args, client) => client.post('/mcp/orders', args), }, { name: 'bos_order_update_status', description: 'Update order status', schema: { order_id: { type: 'string' }, status: { type: 'string', enum: ['pending', 'confirmed', 'processing', 'shipped', 'delivered', 'cancelled'] }, }, handler: async (args, client) => { const { order_id, status } = args; return client.put(`/mcp/orders/${order_id}/status`, { status }); }, }, { name: 'bos_order_cancel', description: 'Cancel an order', schema: { order_id: { type: 'string' }, reason: { type: 'string', optional: true } }, handler: async (args, client) => { const { order_id, reason } = args; return client.post(`/mcp/orders/${order_id}/cancel`, { reason }); }, }, { name: 'bos_order_count_by_status', description: 'Get order counts grouped by status', schema: {}, handler: async (_, client) => client.get('/mcp/orders/count-by-status'), }, { name: 'bos_order_search', description: 'Search orders by invoice number or customer name', schema: { q: { type: 'string' } }, handler: async (args, client) => client.get('/mcp/orders/search', args), }, { name: 'bos_order_transactions', description: 'Get payment transactions for an order', schema: { order_id: { type: 'string' } }, handler: async (args, client) => client.get(`/mcp/orders/${args.order_id}/transactions`), }, { name: 'bos_order_shipping_info', description: 'Get shipping information for an order', schema: { order_id: { type: 'string' } }, handler: async (args, client) => client.get(`/mcp/orders/${args.order_id}/shipping`), }, { name: 'bos_order_update_shipping', description: 'Update shipping status for an order', schema: { order_id: { type: 'string' }, shipping_status: { type: 'string', enum: ['pending', 'shipped', 'delivered', 'returned'] }, tracking_number: { type: 'string', optional: true }, }, handler: async (args, client) => { const { order_id, ...data } = args; return client.put(`/mcp/orders/${order_id}/shipping`, data); }, }, { name: 'bos_order_add_note', description: 'Add a staff note to an order', schema: { order_id: { type: 'string' }, note: { type: 'string' } }, handler: async (args, client) => client.post(`/mcp/orders/${args.order_id}/notes`, { note: args.note }), }, { name: 'bos_order_refund', description: 'Process a refund for an order', schema: { order_id: { type: 'string' }, amount: { type: 'number', optional: true }, reason: { type: 'string', optional: true }, }, handler: async (args, client) => { const { order_id, ...data } = args; return client.post(`/mcp/orders/${order_id}/refund`, data); }, }, ]; - src/index.ts:54-76 (registration)Main tool registration loop: all tools (including orderTools with bos_order_list) are registered with the MCP server via server.tool().
// Register all tools with proper Zod schemas 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, }; } } ); } - src/client/index.ts:90-104 (helper)The BosApiClient.get() method used by bos_order_list's handler to make GET requests to the API.
async get<T>(path: string, params?: Record<string, any>): Promise<T> { return this.request<T>('GET', path, undefined, params); } async post<T>(path: string, data?: any): Promise<T> { return this.request<T>('POST', path, data); } async put<T>(path: string, data?: any): Promise<T> { return this.request<T>('PUT', path, data); } async delete<T>(path: string): Promise<T> { return this.request<T>('DELETE', path); }