Skip to main content
Glama
Pharaoh - Your AI breaks things it can't see

Pharaoh - Your AI breaks things it can't see

by Pharaoh-so

Unused Code

get_unused_code
Read-only

Find code no production entry point reaches by tracing call graph reachability, so you can confirm dead functions before cleanup or verify new code is reachable.

Instructions

Find code nothing runs: functions no production entry point (endpoint, CLI command, cron job, event handler, worker, entry file) reaches.

CALL THIS WHEN: • Cleaning up a module or deleting a function • Confirming new code is reached from an entry point

RETURNS: Reachability through the call graph, not text references. • Dead: unreached, named in no other file, and no import of its file could reach it. • Possibly unused: unreached, but named in other files (string dispatch, dynamic loading) or an import of its file could reach it. Listed with the files that name it. • Used only by tests: exported functions and class methods only test files reference. With functions: each one's status, and the call path from an entry point when it's reachable.

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": {
      "repo": "<repo>"
    },
    "name": "get_unused_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
repoYesRepository name — one of your connected repos.
moduleNoLimit to one module
functionsNoFunction names or Class.method names to check instead of listing everything unused

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.1.1
    • addedInput schema / $schema
      Added value: +"http://json-schema.org/draft-07/schema#"
    • addedInput schema / properties / functions
      Added value: +{
      +  "description": "Function names or Class.method names to check instead of listing everything unused",
      +  "items": {
      +    "type": "string"
      +  },
      +  "maxItems": 20,
      +  "type": "array"
      +}
    • addedInput schema / properties / module
      Added value: +{
      +  "description": "Limit to one module",
      +  "type": "string"
      +}
    • addedInput schema / properties / repo
      Added value: +{
      +  "description": "Repository name — one of your connected repos.",
      +  "type": "string"
      +}
    • addedInput schema / required
      Added value: +[
      +  "repo"
      +]
  2. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Beyond the annotations (readOnlyHint=true, destructiveHint=false, openWorldHint=false), the description adds considerable behavioral context: it analyzes reachability through the call graph rather than text references, explains the dynamic-loading caveat that produces 'possibly unused' results, and clarifies the special 'used only by tests' category. This is exactly the kind of semantic distinction an agent needs to interpret results correctly.

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?

The description is front-loaded with the core purpose, then structured with a 'CALL THIS WHEN' list and a 'RETURNS' breakdown. Every sentence carries useful information; the length is justified by the need to explain reachability classifications and the distinction between dead and possibly unused code.

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?

There is no output schema, so the description must carry the burden of explaining return values, and it does so thoroughly: it defines the three result categories (Dead, Possibly unused, Used only by tests) and explains what additional data appears when `functions` is provided. Given the tool's complexity and the read-only annotations, the definition is complete enough for an agent to invoke and interpret it correctly.

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 description coverage is 100%, so the baseline is 3. The description still adds meaning: it explains that passing `functions` checks specific functions instead of listing everything, and that each result includes status and call path from an entry point when reachable. It also clarifies that `module` limits to one module, though the schema already states this.

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 states a precise verb and resource: find code that nothing runs, and explicitly defines what 'runs' means by naming entry point types (endpoint, CLI command, cron job, event handler, worker, entry file). This is clearly distinguishable from sibling tools like search_functions or get_blast_radius.

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?

The 'CALL THIS WHEN' section gives two concrete scenarios: cleaning up a module or deleting a function, and confirming new code is reached from an entry point. It does not explicitly name alternatives or when not to use it, which keeps it below a 5, but the intended usage context is clear.

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