Skip to main content
Glama

security_html_sanitize

Read-only

HTML sanitizer — Cleans untrusted HTML (user comments, LLM output, scraped pages, emails) so it is safe to render. Allowlist rebuild, not regex stripping: only allowed tags/attributes are re-emitted with re-escaped values; script/style/iframe/object/svg/form contents are dropped; on* event handlers, style, javascript:/vbscript:/data: URLs (entity- and whitespace-obfuscated too) are removed; comments stripped; unclosed tags closed. html= the markup (or url= to fetch a page), profile=strict|basic|rich (rich adds images, tables, sections), relative=0 blocks relative URLs, no_images=1, target_blank=1, link_rel=0 skips rel=noopener noreferrer nofollow. Returns the safe html, verdict CLEAN / CLEANED / DANGEROUS CONTENT REMOVED, and a report of what was removed. Price: $0.003 USDC (Base, via x402).

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": "security_html_sanitize"
  }
}

Input Schema

NameRequiredDescriptionDefault
htmlYes<p onclick="steal()">Hi <b>there</b> <a href="javascript:alert(1)">x</a></p><script>alert(1)</script><img src=x onerror=alert(1)>

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.8/5.0
Behavior3/5

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

The description adds genuinely useful behavior beyond the annotations: allowlist-rebuild semantics, exactly which element classes are dropped, handling of obfuscated javascript:/vbscript:/data: URLs, the CLEAN/CLEANED/DANGEROUS verdict, a removal report, and even the $0.003 USDC x402 price. However, it markets a set of switches (url=, profile=, relative=, no_images=, target_blank=, link_rel=) that do not exist in the supplied schema, which misrepresents the callable surface.

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 the purpose, then proceeds through mechanism, parameters, return shape, and price in a single dense but ordered block — no filler sentences. The clause-per-parameter style is efficient, though the paragraph runs long and the phantom parameter clause is wasted words at best.

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 correctly takes on the burden of stating what comes back: safe html plus a verdict and a removal report. For a high-impact security transform that is the right level of detail, but the documented-vs-actual parameter mismatch keeps it from being fully trustworthy.

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

Parameters2/5

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

Schema coverage is 100% for the single required 'html' param, and the description correctly glosses it as 'the markup', but it then documents six parameters (url, profile, relative, no_images, target_blank, link_rel) that are absent from the input schema. An agent following this text would attempt calls that cannot be satisfied, so the extra parameter discussion actively misleads rather than enriching.

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?

The first clause names a specific verb and resource ('HTML sanitizer — Cleans untrusted HTML') and immediately scopes it with concrete input classes (user comments, LLM output, scraped pages, emails). No sibling in the security_* list performs markup sanitization, so an agent can route here unambiguously.

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?

It states the triggering condition clearly — clean untrusted markup before rendering — and the profile enum (strict|basic|rich, with 'rich adds images, tables, sections') helps the agent pick a mode. It stops short of explicit when-not-to-use guidance or naming an alternative tool (e.g. the headers/CSP siblings) for related-but-different jobs.

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