Skip to main content
Glama

security_csp_analyze

Analyze Content-Security-Policy headers to detect unsafe directives and calculate a security score for XSS protection assessment.

Instructions

Deep analysis of Content-Security-Policy: parse CSP directives, detect unsafe-inline/unsafe-eval/wildcard * and other unsafe configurations, and produce a CSP security score.

中文详情:

  • 用途:深度分析 Content-Security-Policy 策略,解析 CSP 指令,检测不安全配置(unsafe-inline/unsafe-eval/通配符 * 等)并评估 CSP 安全评分

  • 何时使用:CSP 策略上线前评估时;XSS 防护层验证时;第三方脚本加载白名单审查时;CSP 报告异常排查时

  • 输出:{ ok: boolean, url: string, csp: string, directives: object, unsafeDirectives: array, score: number, recommendations: array }

  • 参数:

    • url (string, 必填):目标 URL

  • 错误:URL 不可达抛出 'Request failed';响应无 CSP 头返回 score=0 但 ok=true

  • 示例:{"url":"https://example.com"}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes目标 URL(必填)
Behavior5/5

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

No annotations are provided, but the description fully discloses behavior: it fetches a URL, parses the CSP header, detects unsafe directives, and returns an ok boolean, directives object, unsafeDirectives array, score, and recommendations. It also describes error cases: URL unreachable throws 'Request failed', missing CSP header returns score=0 with ok=true. This covers all behavioral traits beyond the input schema.

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?

The description is organized into clear sections (purpose, usage, output, parameters, errors, example) with both English and Chinese. It is longer than necessary but structured well, and every part adds value. One sentence could be removed (the Chinese title line) without loss, but overall it is efficient.

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

Completeness5/5

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

The tool performs complex CSP analysis with no output schema provided. The description fully covers input, output format, error conditions, and usage context, making it complete for an AI agent to invoke correctly. No additional information is needed.

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% for the single parameter 'url' (type string, required, described in Chinese as 'target URL (required)'). The description adds an example JSON input and explains the parameter context, which adds some value beyond the schema description, justifying a 4 instead of baseline 3.

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 description clearly states the tool analyzes Content-Security-Policy, parses directives, detects unsafe configurations (unsafe-inline, unsafe-eval, wildcard), and produces a security score. It uses a specific verb+resource format and distinguishes itself from sibling security tools like 'security_headers_check' and 'security_scan' by focusing exclusively on CSP.

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

Usage Guidelines5/5

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

The Chinese section explicitly provides usage scenarios: before CSP policy deployment, XSS protection verification, third-party script whitelist review, CSP report anomaly investigation. This gives clear when-to-use guidance and implies alternatives are not needed for this specialized task.

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/validpilot/ai-verify-mcp'

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