Skip to main content
Glama

APIMock

Set fault rule

set_fault_rule

Inject failures into a workspace's mock responses so you can test how the client copes: error statuses (e.g. 503, or 429 with Retry-After), latency, null or dropped JSON fields, or empty lists. Matches by optional method and a path glob, fires with the given probability, and expires automatically (default 60 minutes). For a fault on a single request, send the X-APIMock-Fault header instead (e.g. X-APIMock-Fault: 429;retry-after=2).

Input Schema

NameRequiredDescriptionDefault
bodyNokind=status: response body. Defaults to a gateway-style JSON error.
kindYesstatus: return an error status. latency: delay the response. nullify / drop_field: damage JSON fields. empty: return an empty list.
nameNoLabel shown in the dashboard.
methodNoOnly match this HTTP method. Omit to match every method.
statusNokind=status: HTTP status.
delay_msNokind=latency: base delay in ms (max 30000).
spike_msNokind=latency: extra delay added on a spike.
jitter_msNokind=latency: uniform ± jitter in ms.
workspaceYesTarget workspace slug (from list_workspaces).
probabilityNoChance (0-1) that a matching request gets this fault.
retry_afterNokind=status: Retry-After seconds (useful with 429 and 503).
route_patternNoGlob over the request path. `*` matches any characters, including `/`./*
field_probabilityNokind=nullify/drop_field: per-field chance of damage (0-1).
spike_probabilityNokind=latency: chance of an extra spike.
expires_in_minutesNoMinutes until the rule switches itself off (default 60, max 10080 = 7 days).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only cover the safety profile (not read-only, not destructive, closed-world); the description adds substantial behavior the annotations do not carry — probabilistic firing, method/glob matching semantics, and automatic expiry with a stated default of 60 minutes. That is exactly the extra context an agent needs before creating a persistent rule.

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, no filler. The core capability is front-loaded, the matching/expiry mechanics follow, and the alternative mechanism is placed last where it belongs. Every clause carries information.

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

Completeness4/5

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

For a 15-parameter mutation tool with no output schema but full schema coverage, the description covers the fault taxonomy, matching, probability, and lifetime. It does not mention what is returned on success (e.g. a rule id) or how rules interact, a small remaining gap rather than a blocker.

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 description coverage is 100%, so the structured fields already do the heavy lifting and the baseline is 3. The description rises above that by mapping fault kinds to their effect (429 with Retry-After, null or dropped JSON fields, empty lists) and restating the path-glob match rule, giving the agent a conceptual model of the parameters rather than just names.

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?

The description states a specific verb and resource ('inject failures into a workspace's mock responses') and enumerates the five concrete fault kinds (error statuses, latency, null/dropped fields, empty lists). It is clearly distinguishable from siblings like list_fault_rules or clear_fault_rules 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 Guidelines4/5

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

It gives an explicit when-not with a concrete alternative: for a one-off fault, send the X-APIMock-Fault header instead, with a worked example. It does not explicitly mention the sibling tools clear_fault_rules/list_fault_rules for managing existing rules, which would be needed for a full 5.

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