Skip to main content
Glama

Generate a dead-code removal patch

generate_fix
Destructive

Build a unified-diff patch that removes or comments out statically detected dead code after grep verifies no remaining references; preview by default or apply when validation succeeds.

Instructions

Build a unified-diff patch that removes (or comments out) dead code found by static analysis, after grep verification drops findings that are still referenced.

Returns the diff, patch summary, validation errors and applied status. With apply=False (default) it previews changes; with apply=True it edits files if patch validation succeeds. Refuses to run when the analysis or grep verification was incomplete. Review the diff and run trusted tests before keeping it.

Requires SKYLOS_API_KEY: this tool returns an authentication error unless the MCP server is started with SKYLOS_API_KEY set. Without a key, analyze works (5 calls/day) and the local map tools (change_map and the graph_* tools) work with no limit. The local CLI needs no key: skylos verify <file> and skylos agent install-hooks.

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": {
      "path": "<path>"
    },
    "name": "generate_fix"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeNo"delete" removes dead code; "comment" comments it out instead.delete
pathYesDirectory or file to scan. A relative path resolves against the MCP server's working directory.
applyNoFalse (default) previews the unified diff. True also writes changes when patch validation succeeds.
min_safetyNoSkip findings whose safety score (0.0-1.0; imports score highest, methods lowest) is below this value.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv4.49.0
    • addedInput schema / properties / apply / description
      Added value: +"False (default) previews the unified diff. True also writes changes when patch validation succeeds."
    • addedInput schema / properties / min_safety / description
      Added value: +"Skip findings whose safety score (0.0-1.0; imports score highest, methods lowest) is below this value."
    • addedInput schema / properties / mode / description
      Added value: +"\"delete\" removes dead code; \"comment\" comments it out instead."
    • addedInput schema / properties / path / description
      Added value: +"Directory or file to scan. A relative path resolves against the MCP server's working directory."
  2. Addedv4.10.0

TDQS

A4.1/5.0
Behavior5/5

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

Goes well beyond the destructiveHint=true annotation: it explains the safety gate ("Refuses to run when the analysis or grep verification was incomplete"), the validation precondition for writing, what is returned (diff, summary, validation errors, applied status), and the exact authentication requirement. The pre-flight and auth details are precisely the context annotations cannot convey.

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 core behavior, gating, and default are front-loaded in the opening sentences with no wasted phrasing. The trailing API-key paragraph is useful but drifts into per-tool quotas and local CLI commands unrelated to invoking this tool, diluting focus slightly.

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

Completeness4/5

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

For a destructive, file-writing tool with an output schema, this covers the essential unknowns: precondition gating, write-on-validation semantics, auth requirement, and a review warning. Only the absence of guidance on the `min_safety` knob leaves a small gap.

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 description coverage is 100%, so every parameter is already documented in structured form. The description only restates `mode` and `apply` in prose and never mentions `min_safety`, so it adds no meaning beyond the schema; baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and artifact: "Build a unified-diff patch that removes (or comments out) dead code found by static analysis," and adds the grep-verification filter step. The operation is unmistakable, but nothing in the description contrasts it with sibling tools like `remediate` or `verify_dead_code`.

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?

Clearly frames the preview-vs-write decision ("With apply=False (default) it previews changes; with apply=True it edits files if patch validation succeeds") and adds a caution to review the diff and run trusted tests. It also names which sibling tools still work without an API key, but never explicitly says when to pick this tool over `remediate` or `verify_dead_code`.

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