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.

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": {
      "projectId": "<projectId>",
      "name": "<name>",
      "method": "<method>",
      "path": "<path>"
    },
    "name": "create_mock"
  }
}

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, HEAD, OPTIONS, 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: - Request context (supports ':default' fallback, e.g. {{body.amount:100000}}): {{path.id}}, {{query.page}}, {{header.X-Token}}, {{body.user.name}}, {{form.fieldName}} - Random & UUID: {{random.uuid}} (or {{random_uuid}}), {{random.number:<length>}} (default 6), {{random.alphabet:<length>}} (default 10), {{random.alphanumeric:<length>}} (default 10) - Dynamic Dates: {{random.date:<format>}} or {{random.date:<format>:<offset>}} (e.g. {{random.date:yyyy-MM-dd}}, {{random.date:yyyy-MM-dd HH:mm:ss:+2d}}; offsets: +/-Ns, m, h, d, M, y) - Faker Data (locales: _id, _jp, _kr, _global or :ID, :JP, :KR, :GLOBAL or ('id')): {{faker.name_id}}, {{faker.name_global}}, {{faker.email}}, {{faker.phone_id}}, {{faker.company_kr}}, {{faker.city_jp}}, {{faker.address_id}}, {{faker.jobtitle}}, {{faker.car}}, {{faker.price:<min>:<max>}} (e.g. {{faker.price:10000:500000}}) - State & Environment: {{state.fieldName}} (requires stateLookupExpr), {{env.KEY}} or {{env.KEY:default}} - Array Looping & Conditionals: JSON array object with "__repeat": 3 or "{{query.limit:5}}" or "{{body.items}}" (access item via {{item}} / {{item.field}}), Handlebars {{#if (eq env.MODE "DEV")}}...{{else}}...{{/if}} 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. Changed1 schema field changed
    • changedInput schema / properties / method / description
      Previous value: -"HTTP method: GET, POST, PUT, DELETE, PATCH, etc."New value: +"HTTP method: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, etc."
  2. Changed2 schema fields changed
    • changedInput schema / properties / responseBody / description
      Previous value: -"Default response body payload (used when no rule matches). Supports dynamic expressions:\n- {{path.id}}          → path variable\n- {{query.page}}       → URL query param\n- {{header.X-Token}}   → request header value\n- {{body.user.name}}   → JSON body field\n- {{random_uuid}}      → generated UUID\n- {{faker.name_id}}    → Indonesian fake name\n- {{faker.name_global}} → English fake name\n- {{state.fieldName}}  → value from stateful session (requires stateLookupExpr)\nIMPORTANT: 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."New value: +"Default response body payload (used when no rule matches). Supports dynamic expressions:\n- Request context (supports ':default' fallback, e.g. {{body.amount:100000}}): {{path.id}}, {{query.page}}, {{header.X-Token}}, {{body.user.name}}, {{form.fieldName}}\n- Random & UUID: {{random.uuid}} (or {{random_uuid}}), {{random.number:<length>}} (default 6), {{random.alphabet:<length>}} (default 10), {{random.alphanumeric:<length>}} (default 10)\n- Dynamic Dates: {{random.date:<format>}} or {{random.date:<format>:<offset>}} (e.g. {{random.date:yyyy-MM-dd}}, {{random.date:yyyy-MM-dd HH:mm:ss:+2d}}; offsets: +/-Ns, m, h, d, M, y)\n- Faker Data (locales: _id, _jp, _kr, _global or :ID, :JP, :KR, :GLOBAL or ('id')): {{faker.name_id}}, {{faker.name_global}}, {{faker.email}}, {{faker.phone_id}}, {{faker.company_kr}}, {{faker.city_jp}}, {{faker.address_id}}, {{faker.jobtitle}}, {{faker.car}}, {{faker.price:<min>:<max>}} (e.g. {{faker.price:10000:500000}})\n- State & Environment: {{state.fieldName}} (requires stateLookupExpr), {{env.KEY}} or {{env.KEY:default}}\n- Array Looping & Conditionals: JSON array object with \"__repeat\": 3 or \"{{query.limit:5}}\" or \"{{body.items}}\" (access item via {{item}} / {{item.field}}), Handlebars {{#if (eq env.MODE \"DEV\")}}...{{else}}...{{/if}}\nIMPORTANT: 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."
    • changedInput schema / properties / rules / items / properties / responseBody / description
      Previous value: -"Response body to return when this rule matches. Supports all dynamic expression placeholders (e.g. {{body.user_id}}, {{path.id}}, {{random_uuid}}). IMPORTANT: For JSON responses, do NOT include raw newline characters (\\n) in the JSON payload as it will make the JSON structure malformed."New value: +"Response body to return when this rule matches. Supports all dynamic expression placeholders:\n- Request: {{path.<var>}}, {{query.<param>}}, {{header.<Name>}}, {{body.<jsonPath>}}, {{form.<field>}} (all support ':default' fallback, e.g. {{body.amount:100000}})\n- Random & UUID: {{random.uuid}} (or {{random_uuid}}), {{random.number:<len>}}, {{random.alphabet:<len>}}, {{random.alphanumeric:<len>}}\n- Date/Time: {{random.date:<format>}} or {{random.date:<format>:<offset>}} (e.g. {{random.date:yyyy-MM-dd:+7d}}, offsets: +/-Ns, m, h, d, M, y)\n- Faker (locales: _id, _jp, _kr, _global or :ID, :JP, :KR, :GLOBAL): {{faker.name_id}}, {{faker.email}}, {{faker.phone_id}}, {{faker.company}}, {{faker.city_jp}}, {{faker.address_id}}, {{faker.jobtitle}}, {{faker.car}}, {{faker.price:<min>:<max>}}\n- State & Env: {{state.<fieldName>}}, {{env.<KEY>:<default>}}, JSON array looping with '__repeat' & {{item}}, Handlebars {{#if (eq a b)}}...{{/if}}\nIMPORTANT: For JSON responses, enclose all {{...}} placeholders in double quotes and do NOT include raw newline characters (\\n) in the JSON payload."
  3. First observed

TDQS

A3.9/5.0
Behavior4/5

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

No annotations exist, so the description carries the full burden and largely succeeds: it explains that rules are evaluated in ascending priority with first-match-wins, that top-level responseBody/responseStatus is the fallback, that a missing collectionName target is auto-created, and that the tool response may include a responseBodyWarning field. It does not disclose auth/permission requirements, whether creation is idempotent, or what identifiers the response returns.

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?

It is front-loaded with purpose followed by capitalized imperatives, so the highest-value guidance appears first. It is somewhat repetitive with the schema's own rules/responseBody documentation (priority order and fallback are stated in both), which costs it a point.

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 creation tool with no annotations and no output schema, the description covers the two hardest concepts (rule engine and stateful simulation) well, but it never describes the return value (mock id/slug needed downstream) and omits permission/error behavior. Adequate but with real gaps for a tool of this complexity.

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 earns an extra point by adding cross-field semantics the schema does not state on its own, notably the priority evaluation order, the default-fallback relationship between rules and top-level response fields, and the lookup/capture pairing for stateful simulation.

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 opening sentence states a specific verb and resource ('Create a new mock API endpoint in a project'), which is unambiguous. It does not, however, differentiate itself from the sibling bulk_create_mocks, so an agent must infer that this tool creates one mock at a time.

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?

The description gives strong prescriptive guidance: 'Always use the rules field' to simulate multiple scenarios, and it explains when to reach for stateLookupExpr/stateCaptureExpr for stateful flows, plus a prerequisite to call check_relay_status before using the simceptor local scheme. It stops short of saying when to prefer create_mock over bulk_create_mocks or add_mock_rule, so no explicit exclusion is present.

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