Skip to main content
Glama

PG1 Sovereign Threat Intelligence

check_repo_trap

PG1 Sovereign Threat Intelligence: checks a downloaded project BEFORE you run anything from it, for the untrusted repo trap: a project set up to hijack the AI coding agent that opens it. The classic trap ships a suspicious binary and an encoded data file; a careful agent refuses the binary and writes its own Python decoder, but a file named like a standard-library module (struct.py) sits in the working folder, Python puts that folder first on sys.path, and the agent's own script imports the attacker's file, which starts a detached process and takes SSH keys and tokens. Send the file listing you already have: files[] of { path, size?, executable?, magic_hex? (the first bytes as hex, up to 32), text? (the start of the file, up to 16 KB; send it for README, package.json, setup.py, .npmrc and the .py files at the root) }, up to 2000 files and 256 KB of text. PG1 never fetches a URL, unpacks, decodes, imports or runs anything from the project: deterministic rules over what you sent, no AI model. Reason codes: STDLIB_SHADOW and PY_STARTUP_HOOK (sitecustomize.py, usercustomize.py, .pth) are high; NODE_INSTALL_HOOK (install-time npm scripts, an unusual registry), UNTRUSTED_BINARY (ELF, Mach-O, PE, executable bit), ENCODED_PAYLOAD, DECODER_BAIT (a README telling the reader to decode, run or import something; text that only describes the risk is not flagged), SECRET_PATH_REFERENCE (~/.ssh, cloud credentials, GITHUB_TOKEN, keychains, internal addresses) and PERSISTENCE_HINT (nohup, setsid, launchctl, cron, systemd user units, double fork) are medium. Returns verdict malicious (a shadow or startup hook together with an encoded payload or a binary, or a shadow or hook file that itself reaches for secrets or detaches), suspicious (any other finding) or no_findings, each finding with the paths involved, and plain-language advice (do not run code from the folder; if you must decode, use python3 -I in a sandbox with no secrets and no network, after deleting or renaming the shadowing file). No findings does not prove the project is harmless; never "safe". Nothing is stored: only the verdict and reason codes are logged. Free to start (60/hour per caller). Plans: 25 free checks a day without a key, 500 a day with a free key from https://pg1-ai-agent.vercel.app/keys, monthly plans and pay per check at https://pg1-ai-agent.vercel.app/pricing (check_agent_message and check_repo_trap share one quota).

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": {
      "files": "<files>"
    },
    "name": "check_repo_trap"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNoOptional: a label for the project, echoed back. Never stored.
filesYesThe project's files, up to 2000, paths relative to the project root.

Output Schema

NameRequiredDescriptionDefault
nameNo
noteNo
riskYes
adviceYes
checksNoWhich underlying sources were checked for this result and whether each one completed.
statusNo"unknown" whenever a source needed for this answer timed out, errored, or was skipped - never "no_flags" in that case.
reasonsNoMachine-readable reason codes for anything flagged in this result. Empty when nothing was flagged.
summaryYes
verdictYes
findingsYes
request_idNoUUID for this request, also sent as the X-Request-Id response header.
files_checkedYes
not_inspectedNoFiles whose text would matter (README, package.json, .npmrc, setup.py, root .py files) but was not sent.
rules_versionNo
text_bytes_checkedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

With zero annotations the description carries the full burden and does: it discloses what the service does NOT do (never fetches, unpacks, decodes, imports or runs anything), that analysis is deterministic with no AI model, per-request limits, notification that only verdict and reason codes are logged, the shared quota, and the explicit caveat that no_findings never means "safe." That is unusually rich beyond any structured field.

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 risk scenario, then the input shape, then the reason-code taxonomy and verdict logic, so the structure is easy to scan despite length. The attacker walkthrough and the plans/pricing paragraph are the most expendable passages, but neither buries the actionable content.

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?

Even though an output schema exists, the description spells out the three verdict values, the rule that elevates to malicious, and the remediation advice, plus the quota and logging posture. For a pre-execution safety check with real consequences, nothing an agent needs to decide and call correctly is missing.

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%, so baseline is 3; the description goes further by telling the caller which files deserve text payloads (README, package.json, setup.py, .npmrc, root .py files) and restating the 2000-file / 256 KB caps as a request-level budget. It doesn't explain magic_hex beyond the schema, keeping it below 5.

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 ("checks a downloaded project") plus a precise scope: the untrusted repo trap that hijacks the coding agent opening it. The sys.path shadowing scenario makes the exact failure mode unmistakable, so an agent can distinguish this from check_package or preflight_check without opening a schema.

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?

Gives a clear trigger ("BEFORE you run anything from it") and an operational condition for invoking it ("Send the file listing you already have"). It does not name a sibling alternative or state an explicit when-not, but the timing guidance is unambiguous.

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.