Skip to main content
Glama

create_or_update_stream_route

Create or update a stream route in APISIX-MCP by defining configuration details such as server address, port, upstream, and plugins. Automatically handles existing routes.

Instructions

Create a stream route, if the stream route already exists, it will be updated

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNostream route id
routeYesstream route configuration

Implementation Reference

  • Inline handler function for the 'create_or_update_stream_route' tool. Determines whether to update (PUT) or create (POST) a stream route based on the presence of an 'id' in the arguments, delegating the HTTP request to makeAdminAPIRequest.
    server.tool("create_or_update_stream_route", "Create a stream route, if the stream route already exists, it will be updated", CreateOrUpdateStreamRouteSchema.shape, async (args) => {
      const routeId = args.id;
    
      if (routeId) {
        return await makeAdminAPIRequest(`/stream_routes/${routeId}`, "PUT", args.route);
      } else {
        return await makeAdminAPIRequest(`/stream_routes`, "POST", args.route);
      }
    });
  • Zod schema defining the input structure for the tool: optional 'id' for updates and 'route' configuration object based on StreamRouteSchema.
    export const CreateOrUpdateStreamRouteSchema = z.object({
      id: z.string().optional().describe('stream route id'),
      route: StreamRouteSchema,
    });
  • Direct registration of the tool using McpServer.tool method, specifying name, description, input schema, and handler.
    server.tool("create_or_update_stream_route", "Create a stream route, if the stream route already exists, it will be updated", CreateOrUpdateStreamRouteSchema.shape, async (args) => {
      const routeId = args.id;
    
      if (routeId) {
        return await makeAdminAPIRequest(`/stream_routes/${routeId}`, "PUT", args.route);
      } else {
        return await makeAdminAPIRequest(`/stream_routes`, "POST", args.route);
      }
    });
  • src/index.ts:31-31 (registration)
    Top-level invocation of the setup function that registers the stream route tools, including 'create_or_update_stream_route'.
    setupStreamRouteTools(server);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the upsert behavior (create or update based on existence), which is useful, but fails to cover critical aspects like required permissions, whether updates overwrite or merge configurations, error handling for invalid inputs, or rate limits. For a mutation tool with complex parameters, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and front-loaded, consisting of a single sentence: 'Create a stream route, if the stream route already exists, it will be updated.' It wastes no words and immediately conveys the core functionality (upsert), making it efficient for an agent to parse and understand the tool's primary action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (mutation with nested objects, no annotations, no output schema), the description is insufficient. It lacks details on behavioral traits (e.g., permissions, idempotency), usage context compared to siblings, and output expectations. For a tool that can significantly alter system state, more comprehensive guidance is needed to ensure safe and correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents the two parameters ('id' and 'route') and their nested properties. The description adds no additional meaning beyond implying that 'id' might be used to determine if a stream route exists for updates, but this is not explicitly stated. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Create a stream route, if the stream route already exists, it will be updated.' It specifies the verb ('create or update') and resource ('stream route'), making the intent unambiguous. However, it doesn't differentiate from siblings like 'create_route' or 'update_route', which handle similar resources but with different semantics (create-only or update-only vs. upsert).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'create_route' (for creation only) or 'update_route' (for updates only), nor does it specify prerequisites, such as needing an existing stream route ID for updates. Without this context, an agent might misuse it or overlook more specific tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/api7/apisix-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server