chargebee_code_planner
Generate accurate Chargebee integration code and workflows tailored to your application. Enter your goal and programming language to receive specific code snippets for tasks like updating billing addresses, creating subscriptions, or handling webhooks.
Instructions
Use this tool for any Chargebee integration questions or implementation needs.
Always use this tool to get the accurate integration code guide for Chargebee. This is the main tool developers need when asking about implementing Chargebee functionality (like "how to update billing address", "how to create subscription", "how to handle webhooks", etc.).
This tool will take in parameters about integrating with Chargebee in their application and generates an integration workflow along with the code snippets.
It takes the following arguments:
goal (string): What is the user's goal?
language (enum): Programming language the code to be generated in. Check the user's application language.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| goal | Yes | What is the user's goal? | |
| language | No | Programming language the code to be generated in. Check the user's application language. |
Implementation Reference
- src/tools/code-planner.ts:35-52 (handler)The handler function `generateCodePlanner` that implements the core logic of the `chargebee_code_planner` tool by invoking the Chargebee AI client to generate code plans based on the user's goal and programming language.const generateCodePlanner = async ( parameters: z.infer<typeof codePlannerParameters>, ) => { try { const results = await chargebeeAIClient.getCodePlanner({ query: parameters.goal, language: parameters.language, }); return results; } catch (error) { if (error instanceof Error) { console.error('Error generating code planner:', error.message); return `Failed to generate code planner: ${error.message}`; } console.error('Error generating code planner:', error); return 'Failed to generate code planner'; } };
- src/tools/code-planner.ts:22-28 (schema)Zod schema defining the input parameters for the tool: `goal` (string) and optional `language` (enum of programming languages).const codePlannerParameters = z.object({ goal: z.string().describe(goalParamDescription), language: z .enum(['node', 'python', 'curl', 'java', 'go', 'ruby', 'php', 'dotnet']) .describe(languageParamDescription) .optional(), });
- src/tools/code-planner.ts:57-63 (registration)Tool configuration object exported as `codePlannerTool`, specifying the method name 'chargebee_code_planner', description, parameters, and execute handler.export const codePlannerTool = { method: 'chargebee_code_planner', name: 'Chargebee Code Planner', description: codePlannerPrompt, parameters: codePlannerParameters, execute: generateCodePlanner, };
- src/tools/index.ts:5-8 (registration)Registration of the `codePlannerTool` in the central tools export array, imported from './code-planner.js', which is then used by the MCP server.export const tools: Tool[] = [ codePlannerTool, documentationSearchTool, ];
- src/mcp.ts:43-75 (registration)MCP server method that registers all tools, including `chargebee_code_planner`, by iterating over the tools array and calling `this.tool()` with each tool's method, description, parameters, and wrapped execute function.private registerTools() { tools.forEach((tool) => { this.tool( tool.method, tool.description, tool.parameters.shape, async (arg: any) => { try { const result = await tool.execute(arg, this); return { content: [ { type: 'text' as const, text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text' as const, text: `Error: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }, ); }); }