Skip to main content
Glama

API Keg — Spec Slice (OpenAPI & GraphQL Subgraph Extractor)

Slice OpenAPI 3.0/3.1 or Swagger 2.0 Specification

slice_openapi_spec
Read-onlyIdempotent

Scores OpenAPI/Swagger endpoints against a natural-language query (BM25 + boosted operationId, summary, tags, and path tokens) or explicit operationIds/pathPatterns, walks every reachable JSON Pointer $ref with cycle protection, prunes unused paths/components, and emits ready-to-use curl + TypeScript fetch snippets. Pricing: $0.001 USD per OpenAPI/Swagger subgraph slice (x402 instant micropayment). Pass ?dry_run=true on REST to validate schema free.

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": {
      "spec": "<spec>"
    },
    "name": "slice_openapi_spec"
  }
}

Input Schema

NameRequiredDescriptionDefault
specYesOpenAPI 3.0/3.1 or Swagger 2.0 specification provided as either a parsed JSON object or a serialized JSON string (up to 5 MiB).
queryNoNatural-language task intent (e.g. 'create credit note and refund invoice') scored via Okapi BM25 plus boosted matches on operationId, summary, tags, and path segments.
methodsNoOptional HTTP method allowlist.
operationIdsNoExplicit operationId values to extract (case-insensitive).
pathPatternsNoExplicit path templates or 'METHOD /v1/path/*' glob patterns to extract (e.g. 'POST /v1/invoices/*/refund').
maxOperationsNoMaximum number of matched operations to retain in the sliced OpenAPI spec.
includeSnippetsNoGenerate ready-to-use curl and TypeScript fetch code snippets for each selected operation.
compactDescriptionsNoStrip verbose prose descriptions, examples, and externalDocs while keeping spec-valid response descriptions.

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 already cover safety (readOnly, idempotent, non-destructive, closed-world), yet the description adds substantive context beyond them: per-slice pricing of $0.001 USD via x402 micropayment, a free dry-run validation mode, cycle protection on $ref traversal, unused path/component pruning, and the concrete artifacts returned (curl and TypeScript fetch snippets). That is exactly the kind of cost and side-effect disclosure an agent needs before calling a paid endpoint.

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, with selection mode first, processing pipeline second, and cost/dry-run last. The density is high but every clause carries operative information; the BM25 boost list is the only slightly redundant pass-through of schema content.

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 an 8-parameter, no-output-schema tool, the description covers what is produced (snippets, pruned spec), what it costs, and how to validate cheaply. Remaining gaps are minor: no statement of behavior when zero operations match and no clarification that `includeSnippets=false` omits the snippet output.

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 per-field definitions already carry the individual semantics. The description still adds value by explaining how the selectors relate (query scoring versus explicit operationId/pathPattern globs) and by documenting the REST-only `dry_run` query parameter that is absent from the schema.

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 opens with a specific verb and resource ("Scores OpenAPI/Swagger endpoints") and enumerates the two selectable modes (BM25 `query` versus explicit `operationIds`/`pathPatterns`), plus the follow-on work of $ref resolution, pruning, and snippet emission. The OpenAPI/Swagger scoping implicitly separates it from the `slice_graphql_schema` sibling.

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 clear in-tool routing: use a natural-language `query` for intent search, or pass explicit `operationIds`/`pathPatterns` when the operations are already known, and it points to `?dry_run=true` on REST as a free validation path. It stops short of stating when not to use the tool or naming the sibling as an alternative.

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