# Compress MCP tool outputs into token-efficient LLM context via webhook

> Quick overview This workflow exposes a POST webhook that accepts large tool/MCP outputs, runs parallel compression strategies, enforces a target token budget, and returns an optimized context package with before/after metrics and an audit trail, using HTTP Request calls plus custom JavaScript processing. How it works 1. Receives a POST request on the /mcp-context-optimize webhook containing context/tool results plus optional token budget, strategy, and field include/exclude hints. 2. Validates the payload, estimates baseline size (chars/tokens), creates an optimization session, and signs a short-lived session token. 3. Builds three candidate artifacts (prune/deduplicate, summarize long text, and structure-preserving key extraction) and sends each candidate to an external HTTP endpoint in parallel. 4. Waits for the candidate responses and also runs a hard timeout path to ensure the workflow continues if responses are slow. 5. Scores the candidates, selects the best option that fits the 

- **Domain**: `n8n-workflow-22312.n8n.io`
- **Provider**: n8n.io (https://n8n.io)
- **Kind**: workflow
- **Live-responds (last probe)**: None
- **Signed card**: False
- **Streaming**: False
- **Quality score**: 40%

## URLs
- Agent card: https://n8n.io/workflows/22312
- Page (HTML): https://agenstry.com/agents/n8n-workflow-22312.n8n.io
- Documentation: https://n8n.io/workflows/22312
