You're viewing a demo portfolio

Join the waitlist
PRSM

flatten_messages

Active

Tool of io.github.shayaShav/flatten-mcp

declared in 2.6.1

Flatten a raw Anthropic Messages API messages[] array in memory: every bulky tool_result block (large text or base64 image) larger than min_size bytes is swapped for a compact [FLATTENED id=...] marker, and the originals are returned in "extracted". Persist "extracted" yourself — you are the store — and feed it back to unflatten_messages to restore the conversation byte-for-byte. Purely functional: no session file, no disk, no network; the input is never mutated. This is the same engine as the flatten-mcp library export; for production use inside your own process, prefer importing the library so the conversation does not travel over a transport.

Parameters schema

{
  "type": "object",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "required": [
    "messages"
  ],
  "properties": {
    "messages": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": {}
      },
      "description": "The raw Messages API messages[] array ({ role, content } objects, verbatim)."
    },
    "min_size": {
      "type": "number",
      "default": 1000,
      "description": "Only flatten tool_result blocks larger than N serialized bytes."
    }
  },
  "additionalProperties": false
}

What this tool wraps· 1 endpoint

min confidence0.700.50

Parent server

io.github.shayaShav/flatten-mcp

https://github.com/shayaShav/flatten-mcp

2/7 registries
View full server →