Skip to main content
Glama

localize_fault

Rank suspect Python functions from a traceback or pytest failure log using stack-trace, call-graph, and token-overlap analysis, returning minimal line-numbered AST slices within a token budget.

Instructions

Rank suspect Python functions/methods from a traceback or pytest failure log using hybrid Stack-Trace + AST Call-Graph + BM25 token overlap, returning minimal line-numbered AST slices within a strict token budget.

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": {
      "traceback_text": "<traceback_text>"
    },
    "name": "localize_fault"
  }
}

Input Schema

NameRequiredDescriptionDefault
top_kNoMaximum number of suspect functions to return.
sourcesNoOptional in-memory {rel_path: source_code} map instead of workspace_root.
token_budgetNoMaximum token budget across returned AST code slices.
include_testsNoWhether to include test_* functions in ranked candidates.
traceback_textYesRaw Python traceback or pytest failure output.
workspace_rootNoPath to the workspace directory containing Python files.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A3.5/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the full burden. It usefully discloses the ranking mechanism (stack trace + AST call graph + BM25) and that output is truncated to a strict token budget, but it never states that the tool is read-only, what happens on unparseable sources or missing workspace_root, or how sources overrides workspace_root at runtime.

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?

A single front-loaded sentence that states method, input, and output with no filler. It is dense with compound jargon and would read better split into purpose and output clauses, which keeps it from a 5.

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?

With six parameters but full schema coverage and no output schema, the description is nearly sufficient: it explains the algorithm and characterizes the returned slices. The main residual gap is the absence of any read-only/side-effect statement and error behavior for unparseable or missing Python sources.

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 including top_k, token_budget, include_tests, sources, and workspace_root is already documented in the schema. The description reinforces that the token budget spans the returned AST slices but adds no new semantics such as ranking weights or how ties are broken.

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?

The description names a specific verb (rank) and resource (suspect Python functions/methods) plus the input sources (traceback or pytest failure log) and the output shape (line-numbered AST slices). It does not name any sibling or explicitly distinguish itself from inspect_ast_symbols or verify_patch_integrity, so it stops short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

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

Usage is implied by the input phrasing 'from a traceback or pytest failure log', which signals the diagnostic use case. There is no explicit when-to-use vs when-not-to-use guidance, no prerequisites, and no named alternative for narrower tasks like symbol lookup.

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