bos_customer_count
Retrieve the total number of customers, optionally filtered by status.
Instructions
Get total customer count with optional filters
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No |
Implementation Reference
- src/tools/bos.ts:386-391 (handler)Handler for bos_customer_count: calls GET /mcp/customers/count with optional status filter
{ name: 'bos_customer_count', description: 'Get total customer count with optional filters', schema: { status: { type: 'string', optional: true } }, handler: async (args, client) => client.get('/mcp/customers/count', args), }, - src/tools/bos.ts:389-389 (schema)Input schema for bos_customer_count: optional status filter
schema: { status: { type: 'string', optional: true } }, - src/index.ts:54-76 (registration)Tools are registered via a loop over allTools array, calling server.tool() with name, description, zod schema, and handler execution
// 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/index.ts:36-36 (registration)customerTools (containing bos_customer_count) are spread into the allTools array for registration
...customerTools, - src/tools/index.ts:21-62 (helper)toZodSchema converts simple schema definitions 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); }