Skip to main content
Glama

Create a dynamic route

create_dynamic_route
Destructive

Creates a route draft. Omit graph to seed a complete default graph, then use data.draft.graph as a starting point. Empty graphs are invalid. Omit deploy or set deploy=false to keep the route unpublished; deploy=true changes live routing immediately. Review data.draft.validation, save changes with update_dynamic_route_draft, then use simulate_dynamic_route without version_number to test the draft before deploy_dynamic_route. Optional display_name is a human label separate from the route identifier; it preserves case and spaces. Invoke a deployed route with model=dynamic/; invocation_model contains the exact string. Requires the dynamic_routes:write scope.

Graph format: an object with an elements array. Each element has a unique id, a type, optional properties, and outputs, an object mapping output names to {"elementId":"target-node-id"}. Include id: START, type: start and id: END, type: end; input and output are not node types. A minimal deployable graph (replace the model with an available catalog ID permitted by your policy):

{"elements":[{"id":"START","type":"start","outputs":{"next":{"elementId":"primary"}}},{"id":"primary","type":"model","properties":{"model":"cerebras/gpt-oss-120b"},"outputs":{"success":{"elementId":"END"},"fallback":{"elementId":"END"}}},{"id":"END","type":"end","outputs":{}}]}

Supported node types and properties:

  • start: the START node; outputs.next selects the first node.

  • end: the END node; outputs is {}.

  • model: properties.model is a catalog model ID. outputs.success targets END or an observe node; outputs.fallback targets another model, pool, or END.

  • pool: properties.models contains 2-10 {model,metrics} candidates; properties.expression is a numeric CEL expression such as model.cost, sorted ascending. Uses the same success/fallback outputs as model.

  • conditional: properties.cases contains {id,expression} entries; each expression is a CEL predicate over metadata, auth, and input. Connect an output for each case ID and a default output. The first true case wins.

  • percentage: properties.buckets contains at least two {id,weight} entries with positive integer weights totaling 100. Connect an output for each bucket ID.

  • classifier: properties.cases contains 2-10 {id,label,instructions} entries with unique labels, plus optional context and model properties. Connect an output per case ID; no default output. Classification failures fail the route.

  • observe: properties.criteria defines an asynchronous evaluation, with optional score_type (score or binary), model, threshold, and sample_rate (both greater than 0 and at most 1). Place after model/pool success or another observe node; outputs.next leads to another observe node or END.

Graphs must be acyclic. Every node except END accepts at most one incoming edge; use separate model nodes on separate branches. Deployment requires each path from START to reach a model or pool before END. The route name is the model identifier on chat completions, responses, messages and native calls.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "name": "<name>"
    },
    "name": "create_dynamic_route"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesRoute name; callers invoke the route as dynamic/<name>. Lowercase letters and digits plus '.' '_' '-'; up to 128 characters; unique per organization.
noteNoRelease note recorded on the deployed version. Only read when deploy is true.
graphNoRouting graph object with elements. Each node has id, type, outputs mapping output names to {elementId: targetID}, and optional properties. Include START/start and END/end. Supported types: start, end, model, pool, conditional, percentage, classifier, observe. Omit graph on create to seed a default; copy its returned draft.graph to customize. See tool description for node properties and topology.
deployNoWhen true the draft is validated and deployed as version 1 in the same call; the response then carries deployed_version in meta.
layoutNoEditor canvas positions keyed by element id. Opaque to the gateway; omit when authoring from code.
descriptionNoFree-text description shown in the platform.
display_nameNoOptional human label; preserves case and spaces. Empty uses the route identifier. Editable without deploying.

Output Schema

NameRequiredDescriptionDefault
dataNo
metaNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations declare destructiveHint=true and readOnlyHint=false, but the description goes further by stating that deploy=true changes live routing immediately, that empty graphs are invalid, that graphs must be acyclic, and that every START path must hit a model/pool before END. It also discloses the required `dynamic_routes:write` scope, which no annotation conveys.

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

Conciseness4/5

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

Long but front-loaded: draft/deploy semantics come first, then graph format, then a per-node-type reference, then topology rules. Every section maps to a real decision the caller must make, though the node-type catalog is dense enough that some agents may skim past the critical topology constraints.

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

Completeness5/5

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

For a 7-parameter tool with a deeply nested graph object, this covers the draft lifecycle, deployment side effects, auth scope, node semantics, and a worked example. With an output schema present, it correctly does not need to describe return values beyond pointing at data.draft.validation.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3, but the description adds real meaning beyond it: the graph schema explicitly defers node-type semantics to the description, which supplies properties, output wiring, weight/CEL constraints and a minimal valid example. It says less about layout, description, and note, which the schema already covers.

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

Purpose5/5

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

Opens with a specific verb+resource: "Creates a route draft." It immediately distinguishes draft creation from the sibling write paths (update_dynamic_route_draft, simulate_dynamic_route, deploy_dynamic_route), so an agent can tell it apart from those tools without opening a schema.

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

Usage Guidelines5/5

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

Gives explicit routing instructions: omit graph to seed a default, omit deploy or set deploy=false to stay unpublished, review data.draft.validation, save with update_dynamic_route_draft, simulate without version_number, then deploy_dynamic_route. This is a full when-to-use/when-not sequence naming concrete alternatives.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources