Skip to main content
Glama
Pharaoh-so

Pharaoh - Your AI breaks things it can't see

by Pharaoh-so

get_unused_code

Read-only

Find code no production entry point reaches, including dead code, possibly unused functions, and test-only exports, so you can verify functions before cleanup or deletion.

Instructions

Find code nothing runs: functions no production entry point (endpoint, CLI command, cron job, event handler, worker, entry file) reaches. Pass functions to check whether specific functions are wired in.

CALL THIS WHEN: • Before cleaning up a module or deleting a function • After merging new code, to confirm an entry point reaches it

RETURNS: • Dead: unreached, named in no other file, and no production file imports its file. Safe to delete. • Possibly unused: unreached, but named in other files (string dispatch, dynamic loading) or its file is imported. Listed with the files that name it; check before deleting. • 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.

USE INSTEAD OF: reference searches; references do not prove code runs.

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/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the safety profile is known. The description goes further by defining the Dead/Possibly unused/Used only by tests categories and the caveat about string dispatch and dynamic loading, which materially affects how an agent should act on results. It does not, however, discuss scale or latency for large repos, and it partially duplicates the return-value content that would normally belong to an output 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 purpose is front-loaded in the first sentence and the CALL THIS WHEN / RETURNS / USE INSTEAD OF sections make it scannable. It is slightly longer than strictly necessary, since the RETURNS section restates details that an output schema would normally carry, but nothing is filler.

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

Completeness3/5

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

With no output schema, the description does a good job of explaining the three result categories and the `functions`-mode response. What is missing for a repo-wide analysis tool is any sense of cost or latency on large codebases, and the `module` scoping parameter is never mentioned in prose, leaving a gap in an otherwise complete picture.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% (all three parameters are described in the schema), so the baseline is 3. The description adds meaning for `functions` by framing it as a targeted check that returns status plus a call path from an entry point, but `module` and `repo` are left entirely to the schema.

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 opens with a specific verb and resource: find functions no production entry point (endpoint, CLI command, cron job, event handler, worker, entry file) reaches. It enumerates the exact classes of entry points that count, which lets an agent distinguish this from sibling tools like search_functions or get_codebase_map 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 Guidelines5/5

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

It gives an explicit CALL THIS WHEN section with two concrete triggers (before cleanup, after merging), plus a USE INSTEAD OF directive that names the alternative approach (reference searches) and the reason references are insufficient. When and why-not are both stated directly.

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