Skip to main content
Glama

quick_fix

Destructive

Applies code fixes for a file's diagnostics, such as adding missing imports, and resolves ambiguous fixes by listing options or applying a chosen one.

Instructions

Apply ty's own fixes for a file's diagnostics (today: add the missing import). Example: quick_fix(file_path="src/app.py").

Looks at the file's diagnostics (narrow with line or a rule code such as unresolved-reference), asks ty for the quick fixes, and applies them. Imports are placed after the docstring and the existing imports, merged into an existing from x import ... where there is one. When a diagnostic has several equally good fixes (two modules that both export Path) nothing is applied: the options are listed, and you repeat the call with choice set to part of the title you want (choice="pathlib") or a 1-based choice number. Fixes that only silence the error (# ty: ignore) are skipped unless allow_suppress=true.

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": {
      "file_path": "<file_path>"
    },
    "name": "quick_fix"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeNo
lineNo
applyNo
choiceNo
file_pathYes
allow_suppressNo
max_new_errorsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.0.4

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and idempotentHint=false, so the description does not need to re-establish that writes occur. It adds real behavioral detail: where imports are placed, that ambiguous cases apply nothing and list options, and that suppression fixes are skipped unless `allow_suppress=true` — meaningful value beyond the annotations.

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 and worked example are front-loaded, and the remaining sentences each add a distinct rule (placement, ambiguity handling, suppression). The closing parenthetical on `choice` is slightly long-winded but still earns its place.

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, non-idempotent mutation tool with no output schema and zero schema-description coverage, the definition covers placement semantics, ambiguity fallback, and suppression gating. The only real gap is the undocumented `apply` and `max_new_errors` parameters, which matter because the tool modifies files.

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 carries the burden for 7 parameters. It explains `line`, `code`, `choice` (accepts a title substring or a 1-based number), `allow_suppress`, and `file_path` via the example, but leaves `apply` and `max_new_errors` entirely undefined, so coverage is strong rather than complete.

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 — 'Apply ty's own fixes for a file's diagnostics' — and immediately scopes it with '(today: add the missing import)' plus a call example. That is enough for an agent to distinguish this from generic editing siblings like edit or apply_edit.

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 concrete narrowing guidance ('narrow with `line` or a rule `code` such as `unresolved-reference`') and a clear conflict protocol: if a diagnostic has several equally good fixes, nothing is applied and the agent must re-call with `choice`. It stops short of naming when to prefer a sibling editing tool instead, but the invocation context is unambiguous.

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