create_update_schema_file
Create or update a schema file for a specific API and schema by providing the file path and content. Optionally mark the file as root for protobuf.
Instructions
Create or update a schema file
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiId | Yes | API ID | |
| schemaId | Yes | Schema ID | |
| filePath | Yes | Path to the schema file | |
| content | Yes | File content | |
| root | No |
Implementation Reference
- src/tools/api/apis/index.ts:391-401 (handler)Executes the tool logic: validates required params (apiId, schemaId, filePath, content), then makes a PUT request to create/update the schema file.
async createUpdateSchemaFile(args: any): Promise<ToolCallResponse> { if (!args.apiId || !args.schemaId || !args.filePath || !args.content) { throw new McpError(ErrorCode.InvalidParams, 'apiId, schemaId, filePath, and content are required'); } const { apiId, schemaId, filePath, ...data } = args; const response = await this.client.put( `/apis/${apiId}/schemas/${schemaId}/files/${filePath}`, data ); return this.createResponse(response.data); } - src/tools/api/apis/index.ts:83-84 (registration)Routes the tool name 'create_update_schema_file' to the createUpdateSchemaFile handler method.
case 'create_update_schema_file': return await this.createUpdateSchemaFile(args); - Schema definition for the tool: specifies name, description, and input schema with apiId, schemaId, filePath (required) and content, root as optional.
{ name: 'create_update_schema_file', description: 'Create or update a schema file', inputSchema: { type: 'object', properties: { apiId: { type: 'string', description: 'API ID', }, schemaId: { type: 'string', description: 'Schema ID', }, filePath: { type: 'string', description: 'Path to the schema file', }, content: { type: 'string', description: 'File content', }, root: { type: 'object', properties: { enabled: { type: 'boolean', description: 'Tag as root file (protobuf only)', }, }, }, }, required: ['apiId', 'schemaId', 'filePath', 'content'], }, },