Our internal log search MCP tool returned an array of matching JSON log entries. When an agent queried level: ERROR during an outage, the tool serialized 180,000 log objects into a single 94MB JSON payload.
// In the MCP tool handler:
const MAX_ENTRIES = 50;
const results = await logStore.search(query, { limit: MAX_ENTRIES + 1 });
const hasMore = results.length > MAX_ENTRIES;
const page = results.slice(0, MAX_ENTRIES);
return {
content: [{
type: "text",
text: JSON.stringify({ entries: page, hasMore, nextOffset: offset + MAX_ENTRIES })
}]
};
An unbounded tool payload instantly crashes the node process running the MCP bridge. Hard limits at the transport boundary protect the local machine from runaway model inquiries.