update_global_rule
Modify plugins and attributes of existing global rules in APISIX-MCP to adjust configurations and enable or disable features as needed.
Instructions
Update specific attributes of an existing global rule
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_global_rule"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | global rule ID | |
| plugins | No | plugins configuration |
Implementation Reference
- src/tools/global-rule.ts:10-12 (handler)Implementation of the update_global_rule tool handler. Registers the tool with McpServer and provides an inline async function that makes a PATCH request to the APISIX admin API endpoint `/global_rules/${args.id}` with the provided args.
server.tool("update_global_rule", "Update specific attributes of an existing global rule", UpdateGlobalRuleSchema.shape, async (args) => { return await makeAdminAPIRequest(`/global_rules/${args.id}`, "PATCH", args); }); - src/schemas/plugin.ts:28-31 (schema)Zod schema for validating input to the update_global_rule tool, supporting partial updates to the global rule's id and plugins configuration.
export const UpdateGlobalRuleSchema = createNullablePatchSchema(z.object({ id: z.string().describe("global rule ID"), plugins: PluginSchema, })); - src/tools/global-rule.ts:10-12 (registration)Registration of the update_global_rule tool within the setupGlobalRuleTools function, called from src/index.ts.
server.tool("update_global_rule", "Update specific attributes of an existing global rule", UpdateGlobalRuleSchema.shape, async (args) => { return await makeAdminAPIRequest(`/global_rules/${args.id}`, "PATCH", args); });