create_or_update_proto
Generate or modify protocol configurations (protos) on the APISIX-MCP server, ensuring up-to-date content for seamless integration with large language models (LLMs) and the APISIX Admin API.
Instructions
Create a proto, if the proto already exists, it will be updated
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | proto id | |
| proto | Yes |
Implementation Reference
- src/tools/proto.ts:7-12 (handler)Core handler logic for the 'create_or_update_proto' tool: determines if proto ID is provided and makes appropriate POST or PUT request to the admin API.const protoId = args.id; if (protoId) { return await makeAdminAPIRequest(`/protos/${protoId}`, "PUT", args.proto); } else { return await makeAdminAPIRequest("/protos", "POST", args.proto); }
- src/schemas/protos.ts:7-10 (schema)Zod input schema defining the parameters for the create_or_update_proto tool: optional id and required proto object.export const CreateOrUpdateProtoSchema = z.object({ id: z.string().optional().describe("proto id"), proto: ProtoSchema, });
- src/tools/proto.ts:6-13 (registration)Registers the 'create_or_update_proto' tool on the MCP server with name, description, input schema, and inline handler function.server.tool("create_or_update_proto", "Create a proto, if the proto already exists, it will be updated", CreateOrUpdateProtoSchema.shape, async (args) => { const protoId = args.id; if (protoId) { return await makeAdminAPIRequest(`/protos/${protoId}`, "PUT", args.proto); } else { return await makeAdminAPIRequest("/protos", "POST", args.proto); } });