{"uid":"cap_1SIWLJBdOTF2Fh6EsAEhr","slug":"mcp-security-agentdiet-dev-web-url-distillation-bm25-token-budget-api-6c5486d6","name":"Web URL Distillation & BM25 Token Budget API","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/api)","url":"https://mcp-security.agentdiet.dev/api?utm_source=zero.xyz","method":"GET","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__eP6tmoDcR-OgbnQyLdmM","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 any web URL (or raw HTML) into compact, agent-ready tokens using configurable extraction modes including BM25 budget control","exampleAgentPrompt":"Can you distill https://stripe.com/docs/payments into clean markdown and keep it under 2000 tokens, focused on the query 'payment intents'?","exampleUseCases":[{"title":"LLM cost reduction for research agent","prompt":"Fetch https://en.wikipedia.org/wiki/Transformer_(machine_learning_model) and distill it into structured JSON tables and metadata so I can pass it to my LLM without blowing my token budget."},{"title":"Focused BM25 excerpt for competitor analysis","prompt":"Distill https://openai.com/pricing into a budget excerpt focused on the query 'enterprise pricing tiers', and cap it at 500 tokens."},{"title":"Skeleton outline for long documentation page","prompt":"Can you grab https://docs.aws.amazon.com/s3/index.html and give me just the skeleton outline so I can see the document structure without all the detail?"}],"resultDescription":"Returns a JSON object containing the distilled content (Markdown text, structured JSON tables/metadata, skeleton outline, or BM25-focused budget excerpt), an ROI proof object showing raw vs. distilled token counts, compression ratio, estimated LLM cost savings, and optional cache hit/miss status and billing details.","failureModes":["URL is unreachable or returns a non-200 HTTP status — endpoint may return an error status","Raw HTML is malformed or empty — distillation may produce minimal or no output","max_tokens too low (below 20) — request rejected by schema validation","mode=budget used without a query parameter — BM25 ranking has no target","Rate limiting or payment failure via x402 — billing object may indicate failure","Target page is JavaScript-rendered (SPA) — fetched HTML may be empty shell"],"whenToPreferThis":"Choose this endpoint when an AI agent needs to consume web page content but token cost or context window size is a concern. It is especially useful when you need BM25-focused excerpts relevant to a specific query, structured extraction from documentation pages, or skeleton outlines of long pages. Prefer it over raw fetch + truncation because it provides compression ROI proof and multiple distillation modes.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T07:26:22.509Z","isFirstParty":false,"canonicalSlug":"mcp-security-agentdiet-dev-web-url-distillation-bm25-token-budget-api-e4cae68e"}