{"uid":"cap_-jtwtZSMlvLZWRooVoVdB","slug":"mcp-security-agentdiet-dev-web-distillation-with-bm25-budget-control-0f99109f","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-security.agentdiet.dev/v1/prompt-compress)","url":"https://mcp-security.agentdiet.dev/v1/prompt-compress?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_uURLDNQli8V85pM1VfAGf","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-security.agentdiet.dev","brandSlug":"mcp-security-agentdiet-dev-mpp","brandBaseUrl":"https://mcp-security.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches and distills a URL or raw HTML into compact, token-efficient output with optional BM25-based budget-capped excerpting for LLM context optimization","exampleAgentPrompt":"Can you distill the content at https://stripe.com/docs/payments into compact markdown, using budget mode with a focus query of 'payment intents' and a max token limit of 500?","exampleUseCases":[{"title":"Fitting docs into LLM context window","prompt":"Pull the content from https://platform.openai.com/docs/guides/function-calling and compress it into budget mode with the query 'tool calling examples', keeping it under 300 tokens so I can fit it in my prompt."},{"title":"Extracting structured data from a webpage","prompt":"Distill https://en.wikipedia.org/wiki/Bitcoin into structured mode — I want tables and metadata, not the full article prose."},{"title":"Reducing LLM cost on scraped pages","prompt":"Fetch https://news.ycombinator.com and distill it in markdown mode — I want to know how many tokens you saved versus the raw page and how much LLM cost that would spare me."}],"resultDescription":"Returns a distilled representation of the target URL or HTML in the chosen mode (Markdown, structured JSON, skeleton outline, or BM25 budget excerpt), along with an ROI proof object showing raw token count, distilled token count, tokens saved, compression ratio percentage, estimated LLM cost saved, and an optional billing and cache status block.","failureModes":["URL unreachable or returns non-200 — fetch fails, endpoint returns error status","HTML payload too large — may exceed processing limits","Invalid mode enum value — request rejected with validation error","max_tokens below minimum of 20 — validation error","BM25 query missing when mode=budget — may return unfiltered or error","x402 payment failure — call blocked if payment not completed","Cache miss on first call may add latency","Idempotency-Key collision may return cached prior result unexpectedly"],"whenToPreferThis":"Choose this endpoint when you need to feed live web content into an LLM context window efficiently and cost-effectively, especially when pages are verbose and token budgets are tight. It is ideal over generic scrapers when you need BM25-ranked budget-capped excerpts aligned to a specific query, or when you want structured/skeleton output rather than raw HTML. Prefer it over raw fetch + parse pipelines when you want built-in ROI proof (tokens saved, cost saved) and multiple distillation modes in a single call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T00:32:39.785Z","isFirstParty":false,"canonicalSlug":"mcp-security-agentdiet-dev-web-distillation-with-bm25-budget-control-0f99109f"}