Skip to main content
Glama

create_mock

Create a new mock API endpoint in a project. IMPORTANT: Always use the 'rules' field to set up conditional response logic (the Rule Engine). The Rule Engine allows ONE mock endpoint to return DIFFERENT responses based on request content — this is the primary way to simulate multiple scenarios (success, error, validation failure, auth failure, etc.) without creating separate mocks. Rules are evaluated in ascending 'priority' order; the FIRST rule whose conditions match wins. If NO rule matches, the mock's top-level responseBody/responseStatus is used as the default fallback. Use the 'stateLookupExpr' and 'stateCaptureExpr' fields to enable stateful simulation (e.g., simulate a database that persists data across calls). If collectionName is provided but doesn't exist, it will be auto-created.

Input Schema

NameRequiredDescriptionDefault
nameYesA descriptive name for this mock endpoint (e.g. 'GET User by ID', 'POST Create Payment')
pathYesHTTP resource path. Use curly braces for path variables, e.g. /v1/users/{id} or /orders/{orderId}/items/{itemId}
tagsNoTags for categorization and search, e.g. ['payment', 'checkout', 'transaction']
rulesNoRULE ENGINE: Array of conditional response rules. Each rule defines conditions to match and a different response to return. Rules are evaluated in ascending 'priority' order (1 = highest priority). The FIRST matching rule wins — subsequent rules are skipped. If NO rule matches, the mock's top-level responseBody/responseStatus is returned as fallback. This enables one mock to simulate: success, validation error, auth failure, rate limit, etc. — all in one endpoint. ALWAYS add rules when the endpoint has multiple response scenarios.
methodYesHTTP method: GET, POST, PUT, DELETE, PATCH, etc.
delayMsNoDefault simulated latency delay in milliseconds. Useful for testing timeout handling.
projectIdYesDatabase ID of the project
webhookUrlNoOptional: URL to call as outbound webhook after each request hits this mock. Supports dynamic expressions. LOCAL RELAY OPTION: If developing locally, instead of a public URL, you can use the 'simceptor://local/<path>' scheme (e.g. 'simceptor://local/api/payment/callback') to route webhook payloads through an active Local Relay WebSocket tunnel to your local server. ALWAYS call 'check_relay_status' first to verify if a relay session is active.
descriptionNoOptional detailed description of what this mock simulates. Visible in the dashboard UI. Helps team members understand the purpose.
soapEnabledNoSet to true to enable SOAP / WSDL mode for this mock. Auto-detected if responseHeaders contains 'xml' or responseBody starts with '<'. Set explicitly to true for SOAP services so the UI switches to WSDL / XML editor view.
wsdlContentNoOptional raw WSDL XML content definition for SOAP service discovery (?wsdl).
responseBodyNoDefault response body payload (used when no rule matches). Supports dynamic expressions: - {{path.id}} → path variable - {{query.page}} → URL query param - {{header.X-Token}} → request header value - {{body.user.name}} → JSON body field - {{random_uuid}} → generated UUID - {{faker.name_id}} → Indonesian fake name - {{faker.name_global}} → English fake name - {{state.fieldName}} → value from stateful session (requires stateLookupExpr) IMPORTANT: In JSON payloads, ALL placeholder expressions MUST be enclosed in double quotes (e.g. "amount": "{{body.amount:100000}}") to ensure valid JSON syntax for UI linters and parsers. Do NOT leave placeholders unquoted. Do NOT include raw newline characters (\n) in the JSON payload. NOTE: the tool response includes a `responseBodyWarning` field if responseBody doesn't look like valid JSON (checked structurally, ignoring placeholder values) — if present, fix the body and call test_mock to confirm before assuming the mock works.
webhookMethodNoHTTP method for the webhook. Default: POST.
collectionNameNoCollection folder name to organize this mock (default: 'Default Collection'). Collections are like folders.
responseStatusNoDefault HTTP status code (used when no rule matches). E.g. 200, 201.
webhookDelayMsNoMilliseconds to wait before firing the webhook after the response is sent.
webhookHeadersNoJSON string of headers for the webhook request.
webhookPayloadNoWebhook request body. Supports dynamic expressions to forward request data.
responseHeadersNoDefault response headers as JSON string, e.g. '{"Content-Type":"application/json","X-Custom":"value"}'
stateLookupExprNoSTATEFUL SIMULATION: Expression to look up a saved session state by key before evaluating rules. The resolved key is used to load state data previously saved by stateCaptureExpr. Once loaded, state fields become available in rule conditions as 'state.<fieldName>' and in responseBody as {{state.fieldName}}. E.g. 'request.body.user_id' → loads state for the given user_id. E.g. 'request.header.Authorization' → loads state by auth token.
stateCaptureExprNoSTATEFUL SIMULATION: Expression that determines the key under which to save session state AFTER this request is processed. The request body, response body, and any custom variables (stateCaptureVariables) are saved under this key in Redis (TTL: 15 minutes). Can reference: 'request.body.id', 'request.path.userId', 'response.body.token', etc. Pair with stateLookupExpr on other mocks to build stateful multi-step flows (e.g. register → login → get profile).
stateCaptureVariablesNoSTATEFUL SIMULATION: JSON object string mapping variable names to expressions. These named variables are extracted and saved alongside the full request/response snapshot. E.g. '{"balance":"request.body.amount","userId":"request.body.id"}' → saved as state.balance and state.userId, accessible on subsequent calls via stateLookupExpr. Each value MUST be an expression starting with one of: request./response./body./query./header./path./state./item./random./faker. Any value that does NOT start with one of those prefixes is stored as a literal string as-is (e.g. '{"status":"pending"}' saves the literal text "pending") — it is NOT evaluated as an expression.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It discloses important behavior — rule evaluation order, first-match-wins, fallback to top-level response, auto-creation of missing collections, and stateful simulation — which is valuable. But it omits other mutation-relevant behavior: permissions/auth requirements, what happens when a mock with the same method+path already exists, whether creation is idempotent, and how webhook failures are handled.

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?

The description is front-loaded with the core creation action, then the most important configuration guidance (rules), then stateful simulation. Every sentence covers substantive behavior. It is dense and the emphasis via capitalization and dashes is useful, though the rule-engine paragraph is somewhat long relative to the rest.

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 22-parameter mutation tool with no annotations and no output schema, the description covers the most complex feature (rule engine/stateful simulation) well, and the schema is extremely detailed. However, it does not address creation lifecycle concerns an agent would want to know: uniqueness constraints on path/method, error/side-effect behavior on creation, or auth prerequisites. Those gaps make it adequate but not complete.

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 is 3. The description adds meaning beyond the schema by emphasizing the priority ordering and fallback semantics of rules, and by adding behavior not explicit in the schema: 'If collectionName is provided but doesn't exist, it will be auto-created.' It also frames stateLookupExpr/stateCaptureExpr around a concrete use case (stateful database simulation), which aids correct usage.

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 opens with a specific verb and resource: 'Create a new mock API endpoint in a project.' That is unambiguous about what gets created. However, it never distinguishes this tool from sibling creation tools such as 'bulk_create_mocks' or 'add_mock_rule', so it stops short of the sibling differentiation required for a 5.

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 strong prescriptive guidance for the 'rules' field ('Always use the rules field') and explains the rule engine's purpose and fallback behavior, which is genuine usage context. What's missing is explicit guidance on when to choose this tool over 'bulk_create_mocks', or any when-not-to-use conditions.

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