bos_loyalty_tiers
Retrieve loyalty tier information to manage customer reward levels and eligibility for benefits.
Instructions
Get loyalty tier information
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/bos.ts:520-525 (handler)The handler for 'bos_loyalty_tiers' tool. Makes a GET request to '/mcp/loyalty/tiers' to retrieve loyalty tier information. Takes no arguments (schema: {}).
{ name: 'bos_loyalty_tiers', description: 'Get loyalty tier information', schema: {}, handler: async (_, client) => client.get('/mcp/loyalty/tiers'), }, - src/tools/bos.ts:523-523 (schema)The schema for 'bos_loyalty_tiers' is an empty object (no input parameters required).
schema: {}, - src/tools/bos.ts:479-526 (registration)The 'loyaltyTools' array (which includes 'bos_loyalty_tiers') is exported and then imported in src/index.ts where all tools are registered with the MCP server via server.tool().
export const loyaltyTools: McpTool[] = [ { name: 'bos_loyalty_points_balance', description: 'Get loyalty points balance for customer', schema: { customer_id: { type: 'string' } }, handler: async (args, client) => client.get(`/mcp/loyalty/${args.customer_id}/balance`), }, { name: 'bos_loyalty_points_history', description: 'Get loyalty points transaction history', schema: { customer_id: { type: 'string' }, page: { type: 'number', optional: true }, page_size: { type: 'number', optional: true }, }, handler: async (args, client) => { const { customer_id, ...params } = args; return client.get(`/mcp/loyalty/${customer_id}/history`, params); }, }, { name: 'bos_loyalty_earn', description: 'Earn loyalty points', schema: { customer_id: { type: 'string' }, points: { type: 'number' }, order_id: { type: 'string', optional: true }, description: { type: 'string', optional: true }, }, handler: async (args, client) => client.post('/mcp/loyalty/earn', args), }, { name: 'bos_loyalty_redeem', description: 'Redeem loyalty points', schema: { customer_id: { type: 'string' }, points: { type: 'number' }, reward_id: { type: 'string', optional: true }, }, handler: async (args, client) => client.post('/mcp/loyalty/redeem', args), }, { name: 'bos_loyalty_tiers', description: 'Get loyalty tier information', schema: {}, handler: async (_, client) => client.get('/mcp/loyalty/tiers'), }, ]; - src/index.ts:55-76 (registration)All tools including 'bos_loyalty_tiers' are registered in the MCP server loop. The tools array is spread from imported categories and each tool is registered with server.tool().
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/tools/index.ts:4-62 (helper)The McpTool interface definition used to type the tool objects including 'bos_loyalty_tiers'.
export interface McpTool { name: string; description: string; schema: Record<string, any>; handler: (args: any, client: BosApiClient) => Promise<any>; } export interface ToolCategory { name: string; tools: McpTool[]; } /** * Convert our simple schema format to Zod schema for MCP SDK. * Input: { field: { type: 'string', optional: true, description: '...' } } * Output: z.object({ field: z.string().optional().describe('...') }) */ 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); }