update_route
Modifies attributes of an existing route in APISIX-MCP, including paths, methods, hosts, upstreams, and plugins, to optimize API gateway configurations.
Instructions
Update specific attributes of an existing route
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "update_route"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | route id | |
| route | No | route configuration |
Implementation Reference
- src/tools/route.ts:16-18 (handler)The inline handler function for the 'update_route' tool, which makes a PATCH request to the Admin API endpoint `/routes/${args.id}` with the provided route updates. Note that this is embedded within the tool registration.
server.tool("update_route", "Update specific attributes of an existing route", UpdateRouteSchema.shape, async (args) => { return await makeAdminAPIRequest(`/routes/${args.id}`, "PATCH", args.route); }); - src/schemas/route.ts:64-67 (schema)Zod schema defining the input for the 'update_route' tool: requires route ID and optional partial route configuration for patching.
export const UpdateRouteSchema = createNullablePatchSchema(z.object({ id: z.string().describe("route id"), route: RouteSchema.partial(), })); - src/tools/route.ts:16-18 (registration)Registers the 'update_route' MCP tool with the server, including description, input schema, and handler.
server.tool("update_route", "Update specific attributes of an existing route", UpdateRouteSchema.shape, async (args) => { return await makeAdminAPIRequest(`/routes/${args.id}`, "PATCH", args.route); }); - src/index.ts:23-23 (registration)Top-level call to setupRouteTools, which registers the update_route tool among others.
setupRouteTools(server);