Skip to main content
Glama

check_response

Scan AI-generated responses for security vulnerabilities like canary token leaks and sensitive data exposure to prevent information disclosure.

Instructions

Check an AI response for security issues: canary token leaks and sensitive data exposure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesResponse content to check

Implementation Reference

  • The handler implementation of `check_response` that inspects AI output for canary leaks and sensitive information.
    checkResponse(content: string): ResponseCheckResult {
      const canaryLeak = this._canaryToken ? content.includes(this._canaryToken) : false
    
      if (canaryLeak) {
        this.log.write({
          level: 'CRITICAL',
          layer: 'L6',
          action: 'block',
          detail: this.locale === 'zh'
            ? '检测到系统提示词泄露!Canary token 出现在输出中'
            : 'System prompt exfiltration detected! Canary token found in output',
          pattern: 'canary_leak',
        })
      }
    
      const [, findings] = redactSensitive(content)
      const hasSensitiveData = findings.length > 0
      const summary = findings.map(f => `${f.name}(${f.count})`).join(', ')
    
      if (hasSensitiveData) {
        for (const f of findings) {
          this.log.write({
            level: 'HIGH',
            layer: 'L6',
            action: 'audit',
            detail: this.locale === 'zh'
              ? `AI 回复含敏感数据: ${f.name}: ${f.count} 处 — 已记录审计日志,回复正常发送`
              : `Sensitive data in AI response: ${f.name}: ${f.count} occurrence(s) — audited, response sent as-is`,
            pattern: f.id,
          })
        }
        this.markSensitiveData('llm_response', summary)
      }
    
      return { canaryLeak, sensitiveData: { hasSensitiveData, findings, summary } }
    }
  • MCP server tool registration for `check_response`, mapping the tool to the `guard.checkResponse` method.
    case 'check_response': {
      const result = guard.checkResponse(String(args.content || ''))
      return {
Behavior3/5

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

With no annotations provided, the description carries the full burden. It successfully discloses detection criteria (canary tokens, sensitive data) but omits operational details: whether read-only, what format findings take, or whether it modifies content vs. only reporting.

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

Conciseness5/5

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

Single sentence, front-loaded with action verb. Every clause serves a purpose: defining operation (Check), target (AI response), category (security issues), and specifics (canary tokens, sensitive data). Zero redundancy.

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?

Appropriate for a focused, single-parameter validation tool. The description covers functional intent and detection scope adequately. Minor gap: no output schema exists and description doesn't hint at return format, though this is less critical for a simple check operation.

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?

Despite 100% schema coverage (baseline 3), the description adds value by contextualizing the 'content' parameter as an 'AI response' and clarifying the security examination scope, which elevates understanding beyond the schema's generic 'Response content to check'.

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?

Excellent specificity: verb 'Check', resource 'AI response', and concrete detection targets 'canary token leaks and sensitive data exposure'. Clearly distinguishes from siblings like check_command (shell commands) and check_path (file paths) by specifying the AI response domain.

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?

Provides clear context for when to use—when analyzing AI-generated content for specific security risks (canary tokens and data exposure). Lacks explicit exclusion criteria or named alternatives, though the resource-specificity implicitly guides selection over sibling tools.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jnMetaCode/shellward'

If you have feedback or need assistance with the MCP directory API, please join our Discord server