api-automation
Automatically generates API types, endpoint constants, mock data, and request functions from backend API documentation to streamline integration and development workflows.
Instructions
理解后端接口文档自动生成接口类型、地址常量、mock数据、请求函数等
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiDocs | Yes | 后端接口文档内容 |
Implementation Reference
- src/services/utility/index.ts:261-284 (registration)Registers the 'api-automation' MCP tool, defining its name, description, input schema (apiDocs string), and execute handler that constructs an XML prompt using imported prompt templates and the provided API documentation.private apiAutomation(): void { this.server.addTool({ name: 'api-automation', description: '理解后端接口文档自动生成接口类型、地址常量、mock数据、请求函数等', parameters: z.object({ apiDocs: z .string() .describe('后端接口文档内容'), }), execute: async ({ apiDocs, }) => { const prompt: string = ` <xml> <project-standard>${projectStandardsPrompt}</project-standard> <prompt>${apiAutomationPrompt}</prompt> <apiDocs>${apiDocs}</apiDocs> </xml> ` return prompt }, }) }
- src/server.ts:40-40 (registration)Invokes registerTools on the UtilityTools instance, which in turn calls apiAutomation() to register the 'api-automation' tool.this.utilityTools.registerTools()
- src/services/utility/index.ts:270-283 (handler)The execute handler constructs and returns a structured XML prompt for API automation based on imported templates and the apiDocs input.execute: async ({ apiDocs, }) => { const prompt: string = ` <xml> <project-standard>${projectStandardsPrompt}</project-standard> <prompt>${apiAutomationPrompt}</prompt> <apiDocs>${apiDocs}</apiDocs> </xml> ` return prompt }, })
- Zod schema defining the input parameter 'apiDocs' as a string describing the backend API documentation content.parameters: z.object({ apiDocs: z .string() .describe('后端接口文档内容'), }),