Skip to main content
Glama

apex-dev

Html sanitize

html_sanitize
Read-onlyIdempotent

Sanitize untrusted HTML before feeding to an LLM or UI: strips XSS scripts/iframes/on* handlers/javascript: URIs, detects & removes hidden CSS prompt-injection blocks, and returns safeHtml, clean Markdown, plainText & securityReport. $0.001 per call over x402 or X-API-Key. Call once without payment for terms, then call again with payment.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "html": "<html>"
    },
    "name": "html_sanitize"
  }
}

Input Schema

NameRequiredDescriptionDefault
htmlYesUntrusted HTML to sanitize and convert to safe Markdown (up to 256 KB).
paymentNosigned x402 payment payload (PAYMENT-SIGNATURE).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well beyond the annotations (readOnly, idempotent, non-destructive) by disclosing the threat classes removed, the hidden-CSS prompt-injection detection, the exact return fields, per-call cost, and the auth flow. The payment two-step is behavior an agent could not infer from schema or annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose and effects, then pricing and the payment handshake, with no filler. The first sentence is dense with enumerated items but each earns its place; slightly heavier than needed for a single read.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description compensates by naming safeHtml, clean Markdown, plainText and securityReport, plus cost and payment mechanics. The internal structure of securityReport and failure behavior are left unspecified, a minor residual gap for a two-parameter tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so both parameters are already documented, but the description adds real meaning for 'payment': call once without it to get terms, then call again with it. That sequencing is not expressed in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Sanitize untrusted HTML') and enumerates exactly what it removes (XSS scripts, iframes, on* handlers, javascript: URIs, hidden CSS prompt-injection blocks). It also lists the four outputs, which separates its security-focused scope from plain conversion siblings like html_to_markdown.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a clear trigger condition ('before feeding to an LLM or UI') and procedural guidance for the two-call payment handshake. It does not state when to prefer a plain converter or what happens if the input is already trusted, so exclusions are absent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources