Skip to main content
Glama

WritersLogic verifiable AI agents

conversation-prune

Choose which old messages to drop to hit a token target without touching the cached prompt prefix — Given a conversation, the index of the last message inside the provider's cached prefix, and a token target, returns which messages to drop: whole tool call plus tool result pairs (so no result is left without its call) and messages the caller marked droppable, oldest first or largest first, never inside the cached prefix, never the most recent keepRecent messages, never pinned ones. Everything up

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": {
      "messages": "<messages>",
      "cacheBreakpoint": "<cacheBreakpoint>",
      "targetTokens": "<targetTokens>"
    },
    "name": "conversation-prune"
  }
}

Input Schema

NameRequiredDescriptionDefault
messagesYesUp to 500; 400000 characters of content in total.
strategyNoOrder in which droppable units are removed. Default oldest-first.
tokenizerNoo200k_base or cl100k_base. Any other name (including Claude models) returns status unsupported for items that need counting; caller token counts are always accepted.
keepRecentNoMost recent messages that are never dropped. Default 4.
targetTokensYesTotal tokens to get at or under.
cacheBreakpointYesIndex of the last message inside the cached prefix; -1 when nothing is cached.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources