Inbound MCP sampling/createMessage Reverse-Injection Firewall
validate_mcp_sampling_requestAudits inbound MCP sampling/createMessage callbacks to block cross-server context snooping and token quota hijacking before a connected server samples the host LLM.
Instructions
Audits inbound MCP sampling/createMessage callbacks from connected servers to block cross-server context snooping (includeContext='allServers') and token quota hijacking. Use when filtering a connected MCP server's request to sample the host LLM; for scrubbing text returned from a standard synchronous tools/call response, use sanitize_tool_output_stream instead. Stateless read-only edge call (max 32 KB, 60 RPM): accepts 'sampling_request_json' ('max_tokens_ceiling' defaults to '512'), supports '?demo=true' or L402 (20 sats), and returns HTTP 400 if invalid.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max_tokens_ceiling | No | Maximum completion token quota allowed for server callbacks; defaults to '2048' when omitted. | |
| sampling_request_json | Yes | JSON string or object representing the inbound MCP sampling/createMessage payload. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sampling_safe | Yes | True if the sampling request respects context isolation and token caps. | |
| timestamp_utc | Yes | ISO-8601 UTC timestamp of the inspection. | |
| recommended_action | Yes | Host enforcement action ('APPROVE_SAMPLING_REQUEST' or 'REJECT_SAMPLING_REQUEST'). | |
| violations_detected | Yes | Specific policy violations found in the sampling request. |