Skip to main content
Glama

Tinplate Edge AI Safety, Security & EU Compliance

tinplate_prompt_cache_budgeter

Read-onlyIdempotent

Prompt Cache Key & Context Budgeter API: Estimate tokens, optimize message order for prompt caching, and calculate LLM API costs. (Endpoint: POST /v1/prompt-cache-budgeter)

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": {
      "blocks": "<blocks>"
    },
    "name": "tinplate_prompt_cache_budgeter"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelNoTarget LLM model identifier (e.g., gpt-4o, gpt-4o-mini, o3-mini, claude-3-7-sonnet, claude-3-5-haiku, gemini-2.5-pro, gemini-2.5-flash; unknown models use generic 128K fallback).claude-3-7-sonnet
blocksYesOrdered list of prompt blocks (1 to 200) to analyze for prefix caching and context budgeting.
max_context_tokensNoOptional context window limit in tokens (defaults to the model's built-in context window).
estimated_cache_hitsNoEstimated batch size (1 cache write + `N - 1` cache reads) used to compute USD savings (default 10).
expected_output_tokensNoExpected completion output tokens per request for budget and cost calculations (default 500).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changed
    • addedInput schema / properties / blocks / example
      Added value: +[
      +  {
      +    "content": "You are a contract analyst.",
      +    "id": "sys",
      +    "role": "system",
      +    "volatility": "static"
      +  },
      +  {
      +    "content": "Analyze clause 4.2 of the attached agreement.",
      +    "id": "usr",
      +    "role": "user",
      +    "volatility": "turn"
      +  }
      +]
    • removedInput schema / properties / model / anyOf
      Removed value: -[
      -  {
      -    "enum": [
      -      "gpt-4o",
      -      "gpt-4o-mini",
      -      "o3-mini",
      -      "claude-3-7-sonnet",
      -      "claude-3-5-haiku",
      -      "gemini-2.5-pro",
      -      "gemini-2.5-flash"
      -    ],
      -    "type": "string"
      -  },
      -  {
      -    "maxLength": 64,
      -    "minLength": 1,
      -    "type": "string"
      -  }
      -]
    • changedInput schema / properties / model / description
      Previous value: -"Target LLM model identifier for context limits, cache thresholds, and token pricing (unknown models use generic 128K fallback)."New value: +"Target LLM model identifier (e.g., gpt-4o, gpt-4o-mini, o3-mini, claude-3-7-sonnet, claude-3-5-haiku, gemini-2.5-pro, gemini-2.5-flash; unknown models use generic 128K fallback)."
    • addedInput schema / properties / model / example
      Added value: +"claude-3-7-sonnet"
    • addedInput schema / properties / model / maxLength
      Added value: +64
    • addedInput schema / properties / model / minLength
      Added value: +1
    • addedInput schema / properties / model / type
      Added value: +"string"
  2. Changed11 schema fields changed
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties / blocks / description
      Added value: +"Ordered list of prompt blocks (1 to 200) to analyze for prefix caching and context budgeting."
    • addedInput schema / properties / blocks / items / properties / cacheable / description
      Added value: +"Optional boolean cache hint (`true` treats as `static`, `false` treats as `turn` unless `volatility` is specified)."
    • addedInput schema / properties / blocks / items / properties / content / description
      Added value: +"Prompt text content for this block."
    • addedInput schema / properties / blocks / items / properties / id / description
      Added value: +"Optional identifier for this prompt block (defaults to `block_<index>`)."
    • addedInput schema / properties / blocks / items / properties / role / description
      Added value: +"Message role (`system`, `developer`, `user`, `assistant`, or `tool`; defaults to `user`)."
    • addedInput schema / properties / blocks / items / properties / volatility / description
      Added value: +"Optional explicit cache volatility tier (`static`, `session`, or `turn`)."
    • addedInput schema / properties / estimated_cache_hits / description
      Added value: +"Estimated batch size (1 cache write + `N - 1` cache reads) used to compute USD savings (default 10)."
    • addedInput schema / properties / expected_output_tokens / description
      Added value: +"Expected completion output tokens per request for budget and cost calculations (default 500)."
    • addedInput schema / properties / max_context_tokens / description
      Added value: +"Optional context window limit in tokens (defaults to the model's built-in context window)."
    • addedInput schema / properties / model / description
      Added value: +"Target LLM model identifier for context limits, cache thresholds, and token pricing (unknown models use generic 128K fallback)."
  3. Changed3 schema fields changed
    • addedInput schema / properties / model / anyOf
      Added value: +[
      +  {
      +    "enum": [
      +      "gpt-4o",
      +      "gpt-4o-mini",
      +      "o3-mini",
      +      "claude-3-7-sonnet",
      +      "claude-3-5-haiku",
      +      "gemini-2.5-pro",
      +      "gemini-2.5-flash"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "maxLength": 64,
      +    "minLength": 1,
      +    "type": "string"
      +  }
      +]
    • removedInput schema / properties / model / enum
      Removed value: -[
      -  "gpt-4o",
      -  "gpt-4o-mini",
      -  "o3-mini",
      -  "claude-3-7-sonnet",
      -  "claude-3-5-haiku",
      -  "gemini-2.5-pro",
      -  "gemini-2.5-flash"
      -]
    • removedInput schema / properties / model / type
      Removed value: -"string"
  4. Changed15 schema fields changed
    • removedInput schema / properties / blocks / description
      Removed value: -"Array parameter 'blocks'"
    • addedInput schema / properties / blocks / items / properties
      Added value: +{
      +  "cacheable": {
      +    "type": "boolean"
      +  },
      +  "content": {
      +    "maxLength": 262144,
      +    "type": "string"
      +  },
      +  "id": {
      +    "maxLength": 64,
      +    "type": "string"
      +  },
      +  "role": {
      +    "default": "user",
      +    "enum": [
      +      "system",
      +      "developer",
      +      "user",
      +      "assistant",
      +      "tool"
      +    ],
      +    "type": "string"
      +  },
      +  "volatility": {
      +    "enum": [
      +      "static",
      +      "session",
      +      "turn"
      +    ],
      +    "type": "string"
      +  }
      +}
    • addedInput schema / properties / blocks / items / required
      Added value: +[
      +  "content"
      +]
    • addedInput schema / properties / blocks / maxItems
      Added value: +200
    • addedInput schema / properties / blocks / minItems
      Added value: +1
    • addedInput schema / properties / estimated_cache_hits
      Added value: +{
      +  "default": 10,
      +  "maximum": 10000,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / expected_output_tokens
      Added value: +{
      +  "default": 500,
      +  "maximum": 128000,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • removedInput schema / properties / max_context_tokens / description
      Removed value: -"Numeric parameter 'max_context_tokens' (e.g. 16000)"
    • addedInput schema / properties / max_context_tokens / maximum
      Added value: +2000000
    • addedInput schema / properties / max_context_tokens / minimum
      Added value: +512
    • changedInput schema / properties / max_context_tokens / type
      Previous value: -"number"New value: +"integer"
    • addedInput schema / properties / model / default
      Added value: +"claude-3-7-sonnet"
    • removedInput schema / properties / model / description
      Removed value: -"Parameter 'model' (e.g. \"claude-3-7-sonnet\")"
    • addedInput schema / properties / model / enum
      Added value: +[
      +  "gpt-4o",
      +  "gpt-4o-mini",
      +  "o3-mini",
      +  "claude-3-7-sonnet",
      +  "claude-3-5-haiku",
      +  "gemini-2.5-pro",
      +  "gemini-2.5-flash"
      +]
    • changedInput schema / required
      Previous value: -[
      -  "model",
      -  "max_context_tokens"
      -]New value: +[
      +  "blocks"
      +]
  5. First observed

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false and openWorldHint=false, so the safety profile is fully covered without description help. The description adds only the transport detail (POST endpoint), which is mild context, and says nothing about how savings are derived or what the response contains. The POST verb sits in slight tension with readOnlyHint, but since it is a pure computation endpoint this is not a true contradiction.

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?

A single front-loaded sentence listing the three capabilities, followed by a short endpoint note. No filler or repetition; the endpoint parenthetical is marginally useful for direct API callers but is the only expendable element.

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?

With five parameters, all fully documented in the schema, and no output schema, the description should ideally sketch what comes back (token counts, recommended block ordering, USD savings). It gestures at those outputs through the capability list but never states them, leaving an agent to guess the result shape for a multi-purpose computation tool.

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 description coverage is 100%, with per-field defaults, ranges, enums and a nested block example, so the schema carries the parameter burden. The description's mention of token estimation, ordering, and cost calculation loosely maps to max_context_tokens, blocks, estimated_cache_hits and expected_output_tokens but adds no semantics beyond that mapping.

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 names three concrete operations — token estimation, message-order optimization for prompt caching, and LLM API cost calculation — which is a specific verb+resource set an agent can act on. It does not explicitly distinguish itself from siblings like tinplate_rag_chunker or tinplate_llm_messages_guard, though those appear to be validators rather than budgeters.

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?

Usage is implied by the operation list: an agent can infer this is the tool for sizing a prompt against a context window and projecting cache savings. There is no explicit guidance on when to prefer it, no prerequisites stated, and no named alternative for related tasks such as chunking or message guarding.

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