optimize_prompt_cache_layout
Reorders a single prompt's dynamic mid-turn tokens after static prefix tokens to prevent 1.25x cold-cache invalidation and restore 0.1x warm cache reads. Advisory in-memory simulation that mutates no live prompts and requires no authentication; zero-token inputs return 0 USD cost without error. Sums static_prefix_tokens and dynamic_mid_tokens to compare before_layout_cost_usd against after_layout_cost_usd and net_savings_pct (0-100). Use this tool when diagnosing mid-prompt timestamps or tool outputs that break cache breakpoints; use pin_single_model_prefix_cache instead to project 10-turn session economics for a target model ID.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "optimize_prompt_cache_layout"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| completion_tokens | No | Output completion token count for the turn. | |
| dynamic_mid_tokens | No | Token count of volatile per-turn context that invalidates downstream cache breakpoints. | |
| static_prefix_tokens | No | Token count of invariant system instructions and repository context. |