Skip to main content
Glama

Make a request body cache-friendly

optimize_prompt_payload
Read-onlyIdempotent

No API key needed. Rewrite an OpenAI Chat/Responses or Anthropic Messages request body so its static prefix is provider-cacheable (Anthropic cache_control breakpoints, OpenAI prompt_cache_key). Returns the optimized body, what changed, the token profile and the projected per-request saving. Never changes the tokens the model sees.

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": {
      "body": "<body>"
    },
    "name": "optimize_prompt_payload"
  }
}

Input Schema

NameRequiredDescriptionDefault
bodyYesThe request body
endpointNo
strategyNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, so the bar is lower, and the description still adds real behavioral value: it discloses the return contents (optimized body, diff, token profile, projected saving) and a strong safety guarantee that it never alters the tokens the model sees. It omits whether anything is persisted or rate-limited, keeping it short of a 5.

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?

Three dense sentences, front-loaded with the auth prerequisite and the transformation, then the return contract. No wasted words, though the ordering would be marginally tighter if the 'never changes tokens' guarantee sat earlier.

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 read-only transformer with nested body input and no output schema, the description covers purpose, the auth-free nature, the guarantee of token-equivalence, and the shape of the return value. The remaining gap is the unexplained `strategy` enum, which leaves an agent guessing which mode to choose.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is only 33%: `body` is described only as 'The request body'. The description partially compensates for `endpoint` by naming the three supported request shapes that map to the enum, but `strategy` ('static' vs 'conversation') is an enum with real behavioral consequences that is explained nowhere.

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?

Uses a specific verb ('Rewrite') on a specific resource (an OpenAI Chat/Responses or Anthropic Messages request body) with the concrete goal of provider cacheability, and names the exact mechanisms (cache_control breakpoints, prompt_cache_key). Nothing a sibling like calculate_model_arbitrage or audit_repo_token_waste does overlaps with this.

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?

States the prerequisite 'No API key needed' and implies the situation (you have a request body you want to make cache-friendly), but never says when to reach for this versus the sibling cost tools, nor when to prefer one endpoint/strategy over another. Usage is inferable but not directed.

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.