{"uid":"cap_59X-W3-EARZFkQkL30VRW","slug":"mcp-compiler-agentdiet-dev-web-distillation-with-bm25-budget-control-25c01253","name":"Web Distillation with BM25 Budget Control","description":"Distill a URL or raw HTML payload with BM25 budget control (Live x402 v2, IETF MPP & MCP endpoint at https://mcp-compiler.agentdiet.dev/v1/rag-chunk)","url":"https://mcp-compiler.agentdiet.dev/v1/rag-chunk?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","minLength":1,"description":"Target webpage URL to fetch and distill (or builtin://stripe-docs)"},"html":{"type":"string","description":"Optional raw HTML string to distill directly without fetching"},"mode":{"enum":["markdown","structured","skeleton","budget"],"type":"string","default":"markdown","description":"Distillation mode"},"query":{"type":"string","description":"BM25 focus query when mode=budget"},"max_tokens":{"type":"integer","minimum":20,"description":"Strict token budget ceiling when mode=budget"}}},"responseSchema":{"type":"object","required":["status","roi_proof","data"],"properties":{"data":{"type":"object","description":"Distilled Markdown, structured JSON tables/metadata, skeleton outline, or BM25 budget excerpt."},"cache":{"type":"object","properties":{"status":{"enum":["HIT","MISS"],"type":"string"},"cache_key":{"type":"string"},"latency_ms":{"type":"number"}}},"status":{"type":"string","description":"Execution status ('ok')"},"billing":{"type":"object","properties":{"agent_id":{"type":"string"},"payment_method":{"type":"string"},"fee_charged_usd":{"type":"number"}}},"roi_proof":{"type":"object","properties":{"raw_tokens":{"type":"integer"},"tokens_saved":{"type":"integer"},"roi_multiplier":{"type":"number"},"distilled_tokens":{"type":"integer"},"llm_cost_saved_usd":{"type":"number"},"compression_ratio_pct":{"type":"number"}}}}},"example":null,"exampleRequest":null,"tags":[],"displayCostAmount":"0.001","displayCostAsset":"USD","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"mpp","network":"tempo","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"mpp","network":"tempo","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_p0MjS6k5ffa8WgpcZB8Zf","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"mcp-compiler.agentdiet.dev","brandSlug":"mcp-compiler-agentdiet-dev-mpp","brandBaseUrl":"https://mcp-compiler.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches and distills a URL or raw HTML into Markdown, structured JSON, skeleton outline, or a BM25-focused token-budget excerpt","exampleAgentPrompt":"Distill https://stripe.com/docs/payments into clean markdown with a 500-token budget, focusing on the query 'payment intents setup' using budget mode.","exampleUseCases":[{"title":"RAG preprocessing for documentation","prompt":"Fetch and distill https://docs.openai.com/api-reference into structured markdown so I can feed it into my RAG pipeline — keep it under 800 tokens using budget mode with the query 'embeddings endpoint'."},{"title":"Token-efficient competitor page analysis","prompt":"Grab the HTML from this Shopify pricing page and distill it in budget mode focused on 'pricing tiers', keeping the output under 300 tokens so I'm not burning LLM budget on noise."},{"title":"Skeleton outline of a long article","prompt":"Pull https://en.wikipedia.org/wiki/Large_language_model and give me a skeleton outline of the page so I can see the structure before deciding which sections to read in full."}],"resultDescription":"Returns a status field, distilled data object (Markdown, structured JSON, skeleton, or BM25 excerpt depending on mode), an ROI proof block showing raw vs distilled token counts, compression ratio, and estimated LLM cost saved, plus optional cache hit/miss metadata and billing info.","failureModes":["URL is unreachable or returns non-200 — distillation fails with fetch error","Raw HTML is malformed or empty — parser returns minimal or empty output","max_tokens set below content minimum — may return truncated or error response","BM25 query not provided when mode=budget — may fall back to unfiltered budget trim","Payment not included or insufficient — HTTP 402 returned blocking execution","Rate limiting or timeout on remote URL — latency spike or failure"],"whenToPreferThis":"Choose this endpoint when you need to reduce token cost before passing web content to an LLM, especially for RAG pipelines or agent workflows where context window size matters. It is ideal when you have a specific focus query (BM25 mode) or need structured extraction (tables/metadata) from arbitrary URLs. Prefer it over raw fetch+parse when compression ratio and cost savings are important, or when you need a skeleton outline for navigation before deep reading.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-23T06:33:25.939Z","isFirstParty":false,"canonicalSlug":"mcp-compiler-agentdiet-dev-web-distillation-with-bm25-budget-control-56b55cd3"}