{"uid":"cap_DEvQl2SFIFx4Cn3w5fwtx","slug":"mcp-security-agentdiet-dev-semantic-html-pruner-with-bm25-budget-41669e72","name":"Semantic HTML Pruner 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/semantic-html-pruner)","url":"https://mcp-security.agentdiet.dev/v1/semantic-html-pruner?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_EsfrvdbdtpQ0l4nb35s0x","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 compressed Markdown, structured data, skeleton outlines, or BM25-ranked token-budget excerpts focused on a query","exampleAgentPrompt":"Fetch https://stripe.com/docs/payments and distill it into budget mode focused on 'webhook setup', keeping it under 800 tokens so I can fit it into my prompt.","exampleUseCases":[{"title":"Fit docs into agent context window","prompt":"Grab the OpenAI API docs page at https://platform.openai.com/docs/guides/function-calling and compress it into clean markdown — I need to pass it to another model without blowing my context limit."},{"title":"BM25 query-focused excerpt for research","prompt":"Distill https://en.wikipedia.org/wiki/Transformer_(machine_learning_model) in budget mode, focused on the query 'attention mechanism', and keep it under 600 tokens so I only get the most relevant parts."},{"title":"Extract structured metadata from a product page","prompt":"Pull https://www.apple.com/iphone-16-pro/ and give me the structured mode output — I want all the tables, specs, and metadata extracted as JSON rather than raw HTML."}],"resultDescription":"Returns a JSON object with a 'data' field containing the distilled content (Markdown text, structured JSON, skeleton outline, or BM25-ranked excerpt), an ROI proof block showing raw vs distilled token counts, compression ratio, tokens saved, and estimated LLM cost saved in USD, plus optional cache hit/miss status and billing details.","failureModes":["URL is unreachable or returns non-200 — fetch fails with error status","HTML payload too large or malformed — pruner may timeout or return partial result","mode=budget without a query field — BM25 ranking cannot score without a focus query","max_tokens set below 20 — rejected by schema validation","Payment not included or insufficient — HTTP 402 returned blocking execution","Target page is JavaScript-rendered SPA — static fetch may return empty or minimal content"],"whenToPreferThis":"Choose this endpoint when an AI agent needs to ingest web content but must stay within a token budget, reduce LLM inference costs, or extract only query-relevant passages from long HTML pages. It is especially valuable for pipelines that repeatedly fetch documentation, news, or product pages and pass them downstream to LLMs — the built-in ROI proof makes cost savings auditable. Prefer this over generic scrapers when you need BM25-ranked relevance filtering or multiple distillation modes (markdown, structured, skeleton, budget) in a single API call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T12:38:39.575Z","isFirstParty":false,"canonicalSlug":"mcp-security-agentdiet-dev-semantic-html-pruner-with-bm25-budget-41669e72"}