Skip to main content
Glama

upsert_rewrite_rule

Adds or updates a rewrite policy with ordered match groups, evaluated in sequence without short-circuiting. Requires rule metadata and group conditions/actions.

Instructions

Add or update a rewrite policy with ordered MatchGroups. To update, ensure the rule object has an 'id'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rule_jsonYesJSON string specifying Policy metadata. Example: {"name":"Mock API","enabled":true,"priority":100}
groups_jsonYesJSON string array of MatchGroup objects. Each group has group_key, order, conditions (AND) and actions. Multiple groups are evaluated in order without short-circuiting.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.4/5.0
Behavior2/5

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

With no annotations, the description carries the full behavioral burden for a mutation tool. It discloses that updates are keyed on 'id' and that groups are ordered, but says nothing about permissions, what happens to existing rules not supplied, duplicate/conflict behavior, or whether the operation is reversible.

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?

Two sentences, front-loaded with the core action and followed by the update precondition. No filler or redundancy.

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

Completeness3/5

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

For a two-parameter mutation tool with no annotations and no output schema, the description covers the essentials of identification and ordering but leaves behavioral gaps (error/conflict handling, return expectations, permissions) unaddressed. Adequate but with clear missing pieces.

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 the baseline would be 3, but the description adds a genuinely useful detail not present in the schema: the 'id' field that turns an add into an update. The schema example shows only name/enabled/priority, so this 'id' guidance fills a real gap.

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 states a specific verb pair (add/update) and resource (rewrite policy), making it distinguishable from siblings like delete_rewrite_rule and list_rewrite_rules. It does not differentiate itself from the similarly named upsert_rewrite_script, but the policy-vs-script distinction is reasonably implied.

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

Usage Guidelines3/5

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

It gives one concrete usage precondition: include an 'id' in the rule object to perform an update, which clarifies the upsert semantics. However, it offers no guidance on when to prefer this over upsert_rewrite_script, nor any prerequisites or exclusions.

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