Skip to main content
Glama

code_audit

Run a deterministic security audit on code snippets or local paths to detect AI-specific risks like hidden characters, encoded payloads, and prompt injection in comments/configs.

Instructions

Run a deterministic security audit (PITAX rule set) over a code snippet or a local path.

Use when the user asks to review a code snippet or a repository for AI-specific security issues (prompt injection in comments/docs/configs, invisible characters, encoded payloads, trojan-source patterns). Hidden characters, encoded payloads, or split/override instructions INSIDE code, code comments, or config values are mine, not pitax_scan's — if the suspicious text sits in a code context (even one line like x = 1 # <payload>), call code_audit. If the content is pasted inline in the user's message, pass it via code — do not guess paths or scan unrelated workspace files (e.g. policy/instruction documents). Pass exactly one of code or path. language is optional (python, js, ts, go, …). formats (optional, "json,sarif,markdown,html" subset) writes full report artifacts locally and returns their paths. Not for: full multi-agent verdicts or attack-chain reasoning — this is the deterministic rules layer only.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "code_audit"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeNo
pathNo
formatsNo
languageNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.5

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does disclose key traits: it is a deterministic rules layer only, and `formats` causes report artifacts to be written locally with paths returned — a real side effect an agent needs to know. It omits any mention of permissions, runtime cost, or whether it is read-only over the target files, which keeps it short of a 5.

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 one-line purpose, then usage, then an explicit exclusion, which is the right order. It is longer than strictly necessary — the visible-character/trojan-source enumeration and the inline `x = 1 # <payload>` example repeat the same point — and the hard line breaks interrupt sentences mid-clause.

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?

For a 4-optional-parameter analyzer with an output schema in place, nothing critical is missing: input modes, mutual exclusivity, artifact side effects, and scope boundaries are all covered. Return-value detail can be deferred to the output schema.

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 0%, so the description must compensate and largely does: it explains `code` (inline pasted content), `path` (local path), the exclusivity constraint ('Pass exactly one of `code` or `path`'), `language` as optional with example values, and `formats` with its allowed subset. It does not clarify path resolution (absolute vs relative) or the empty-string defaults, so a small gap remains.

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 ('Run a deterministic security audit (PITAX rule set)') plus the two input modes (code snippet or local path). It explicitly carves out scope against the sibling `pitax_scan`, so an agent can route between them without opening either schema.

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?

Gives trigger conditions (AI-specific security issues: prompt injection in comments/docs/configs, invisible characters, trojan-source patterns), an explicit disambiguation rule against `pitax_scan` ('if the suspicious text sits in a code context... call `code_audit`'), an anti-pattern ('do not guess paths or scan unrelated workspace files'), and a 'Not for' exclusion (multi-agent verdicts, attack-chain reasoning).

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