Skip to main content
Glama

Explain a Python import/attribute/signature error

explain_error
Read-onlyIdempotent

Explains Python library import, attribute, and type errors by identifying what changed, when, why it broke, and which version pin restores the old API.

Instructions

Call this when a third-party Python library raises ImportError ('cannot import name'), ModuleNotFoundError, AttributeError ('has no attribute'), or TypeError ('unexpected keyword argument' / 'missing required argument'). Returns what changed, in which release, the deprecation message, replacement candidates with evidence, and the version pin that restores the old API. Pass installed versions for an exact answer. An error DepTime can't explain returns empty findings rather than a guess; check note and not_covered.

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": "<traceback>"
    },
    "name": "explain_error"
  }
}

Input Schema

NameRequiredDescriptionDefault
tracebackYesTraceback text, or at least the final 'SomeError: message' line. Long logs are fine: only the last 20,000 characters are analysed.
pip_freezeNoOutput of `pip freeze` / `uv pip freeze` / `pip list`.
min_confidenceNoLeave out findings below this confidence; the answer counts them in below_min_confidence.
installed_versionsNoInstalled versions, e.g. {"httpx": "0.28.1"}. Add "python": "3.12" when a standard-library module is missing.

Output Schema

NameRequiredDescriptionDefault
noteNo
signalYes
findingsYes
suppressedNoFindings left out by the project's suppressions (deptime.toml or [tool.deptime] in pyproject.toml); `note` says so whenever it isn't 0.
not_coveredNoPackages involved in the error that DepTime does not index.
below_min_confidenceNoFindings left out below the min_confidence asked for.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.2.3
    • addedOutput schema / $defs / ErrorSignalOut / properties / kind / description
      Added value: +"What the error says: import_name | module_missing | module_attribute | object_attribute | class_attribute | unexpected_kwarg | missing_argument | too_many_positional, or circular_import | unknown (recognized and declined). New kinds may be added."
    • changedOutput schema / $defs / Finding / properties / issue / enum
      Previous value: -[
      -  "symbol_removed",
      -  "symbol_not_yet_added",
      -  "never_existed",
      -  "param_removed",
      -  "param_not_yet_added",
      -  "param_now_required",
      -  "param_kind_changed",
      -  "module_removed",
      -  "present_in_installed_version"
      -]New value: +[
      +  "symbol_removed",
      +  "symbol_not_yet_added",
      +  "never_existed",
      +  "param_removed",
      +  "param_not_yet_added",
      +  "param_now_required",
      +  "param_kind_changed",
      +  "module_removed",
      +  "present_in_installed_version",
      +  "now_raises"
      +]
    • addedOutput schema / $defs / Finding / properties / raises
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "For now_raises: the exception and message recorded from the library. Untrusted data.",
      +  "title": "Raises"
      +}
    • addedOutput schema / $defs / Finding / properties / raises_since
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "For now_raises: the release where the callable started only raising, when known.",
      +  "title": "Raises Since"
      +}
  2. Changed1 schema field changedv0.1.13
    • addedOutput schema / $defs / Finding / properties / defined_at
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Where the object `symbol` names is defined, when that's another path (DT-CORE-55): selenium's `webdriver.Chrome` is `selenium.webdriver.chrome.webdriver.WebDriver`, httpx's `Client` is `httpx._client.Client`. Same form as `symbol`. Write code against `symbol`; this is the path in the library's source and its tracebacks. None when they're the same, or the index doesn't have it.",
      +  "title": "Defined At"
      +}
  3. Changed14 schema fields changedv0.1.8
    • changedInput schema / properties / installed_versions / description
      Previous value: -"Installed versions, e.g. {\"httpx\": \"0.28.1\"}."New value: +"Installed versions, e.g. {\"httpx\": \"0.28.1\"}. Add \"python\": \"3.12\" when a standard-library module is missing."
    • addedInput schema / properties / min_confidence
      Added value: +{
      +  "anyOf": [
      +    {
      +      "enum": [
      +        "high",
      +        "medium",
      +        "low"
      +      ],
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Leave out findings below this confidence; the answer counts them in below_min_confidence.",
      +  "title": "Min Confidence"
      +}
    • addedOutput schema / $defs / ErrorSignalOut / properties / python_version
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Python version (3.X) the traceback's file paths name, when they agree.",
      +  "title": "Python Version"
      +}
    • addedOutput schema / $defs / Finding / properties / confidence_factors
      Added value: +{
      +  "description": "Why it has its confidence. installed_version_*: the installed version is an indexed release, lies between two (or after the newest, or before the first), or wasn't given; python_version_*: for the standard library, given, read from the traceback's paths, or unknown; module_static / module_has_getattr / served_by_getattr: whether the name's module defines a __getattr__ that can create names at runtime, and whether this name is one it serves; public_name / internal_name; replacement_*: where the first replacement comes from (the library's own text, inferred from the index, a curated guide, or the error message).",
      +  "items": {
      +    "enum": [
      +      "installed_version_indexed",
      +      "installed_version_between_releases",
      +      "installed_version_after_newest",
      +      "installed_version_before_first",
      +      "installed_version_unknown",
      +      "python_version_given",
      +      "python_version_from_traceback",
      +      "python_version_unknown",
      +      "module_static",
      +      "module_has_getattr",
      +      "served_by_getattr",
      +      "public_name",
      +      "internal_name",
      +      "replacement_from_library",
      +      "replacement_inferred",
      +      "replacement_curated",
      +      "replacement_from_error"
      +    ],
      +    "type": "string"
      +  },
      +  "title": "Confidence Factors",
      +  "type": "array"
      +}
    • addedOutput schema / $defs / Finding / properties / fix
      Added value: +{
      +  "anyOf": [
      +    {
      +      "$ref": "#/$defs/Fix"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "A mechanical change the index proves, never written text: a replacement at confidence >= 0.75, or the same object at another public path, that the index shows at the installed release (else the newest). None when no replacement qualifies."
      +}
    • changedOutput schema / $defs / Finding / properties / issue / enum
      Previous value: -[
      -  "symbol_removed",
      -  "symbol_not_yet_added",
      -  "never_existed",
      -  "param_removed",
      -  "param_not_yet_added",
      -  "param_now_required",
      -  "module_removed",
      -  "present_in_installed_version"
      -]New value: +[
      +  "symbol_removed",
      +  "symbol_not_yet_added",
      +  "never_existed",
      +  "param_removed",
      +  "param_not_yet_added",
      +  "param_now_required",
      +  "param_kind_changed",
      +  "module_removed",
      +  "present_in_installed_version"
      +]
    • addedOutput schema / $defs / Finding / properties / links
      Added value: +{
      +  "description": "The releases on each side of the change on PyPI, then the project's changelog or release notes when its metadata names them.",
      +  "items": {
      +    "$ref": "#/$defs/Link"
      +  },
      +  "title": "Links",
      +  "type": "array"
      +}
    • addedOutput schema / $defs / Finding / properties / signature_after
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "$ref": "#/$defs/ParamInfo"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Its parameters at the release after the change: first_version_without, or first_version_with for *_not_yet_added, else resolved_version. None when it isn't a callable there (a removed one).",
      +  "title": "Signature After"
      +}
    • addedOutput schema / $defs / Finding / properties / signature_before
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "$ref": "#/$defs/ParamInfo"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "For a callable (a class: its __init__), its parameters at the release before the change: last_version_with, or last_version_without for *_not_yet_added. None when it isn't a callable there.",
      +  "title": "Signature Before"
      +}
    • addedOutput schema / $defs / Fix
      Added value: +{
      +  "properties": {
      +    "confidence": {
      +      "description": "The confidence of the replacement it comes from.",
      +      "maximum": 1,
      +      "minimum": 0,
      +      "title": "Confidence",
      +      "type": "number"
      +    },
      +    "evidence": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "The replacement's evidence.",
      +      "title": "Evidence"
      +    },
      +    "kind": {
      +      "description": "path: use the dotted path `new` where the code uses `old`; argument: pass the keyword argument `new` instead of `old`; keyword: pass the argument the call gives by position as `new=...`.",
      +      "enum": [
      +        "path",
      +        "argument",
      +        "keyword"
      +      ],
      +      "title": "Kind",
      +      "type": "string"
      +    },
      +    "new": {
      +      "title": "New",
      +      "type": "string"
      +    },
      +    "old": {
      +      "title": "Old",
      +      "type": "string"
      +    },
      +    "same_object": {
      +      "default": false,
      +      "description": "True when nothing else needs to change: `new` is the very definition `old` was (a path), or the same parameter renamed with only its case or underscores changed (an argument). False when it is another object or parameter that the library, or a curated guide, names instead: its arguments or value may differ, so read `evidence`.",
      +      "title": "Same Object",
      +      "type": "boolean"
      +    },
      +    "signature": {
      +      "anyOf": [
      +        {
      +          "items": {
      +            "$ref": "#/$defs/ParamInfo"
      +          },
      +          "type": "array"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "For a path to a callable (a class: its __init__), its parameters at `verified_at`.",
      +      "title": "Signature"
      +    },
      +    "source": {
      +      "description": "A replacement's source, or signature: the indexed signatures show it (a parameter that became keyword-only).",
      +      "enum": [
      +        "deprecation_message",
      +        "moved_heuristic",
      +        "curated",
      +        "error_message",
      +        "signature"
      +      ],
      +      "title": "Source",
      +      "type": "string"
      +    },
      +    "verified_at": {
      +      "description": "The indexed release in which the index shows `new`: the installed version's, else the newest.",
      +      "title": "Verified At",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "kind",
      +    "old",
      +    "new",
      +    "verified_at",
      +    "confidence",
      +    "source"
      +  ],
      +  "title": "Fix",
      +  "type": "object"
      +}
    • addedOutput schema / $defs / Link
      Added value: +{
      +  "properties": {
      +    "title": {
      +      "description": "What the page is, e.g. 'httpx 0.28.0 on PyPI' or 'httpx Changelog'.",
      +      "title": "Title",
      +      "type": "string"
      +    },
      +    "url": {
      +      "description": "A PyPI release page, or a page the project's own metadata (Project-URL) names. Untrusted data.",
      +      "title": "Url",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "title",
      +    "url"
      +  ],
      +  "title": "Link",
      +  "type": "object"
      +}
    • addedOutput schema / $defs / ParamInfo
      Added value: +{
      +  "properties": {
      +    "annotation": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "title": "Annotation"
      +    },
      +    "default": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "title": "Default"
      +    },
      +    "kind": {
      +      "description": "positional-only | positional or keyword | variadic positional | keyword-only | variadic keyword",
      +      "title": "Kind",
      +      "type": "string"
      +    },
      +    "name": {
      +      "title": "Name",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "name",
      +    "kind"
      +  ],
      +  "title": "ParamInfo",
      +  "type": "object"
      +}
    • addedOutput schema / properties / below_min_confidence
      Added value: +{
      +  "default": 0,
      +  "description": "Findings left out below the min_confidence asked for.",
      +  "title": "Below Min Confidence",
      +  "type": "integer"
      +}
    • addedOutput schema / properties / suppressed
      Added value: +{
      +  "default": 0,
      +  "description": "Findings left out by the project's suppressions (deptime.toml or [tool.deptime] in pyproject.toml); `note` says so whenever it isn't 0.",
      +  "title": "Suppressed",
      +  "type": "integer"
      +}
  4. Changed4 schema fields changedv0.1.5
    • addedOutput schema / $defs / Finding / properties / first_version_with
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "For *_not_yet_added: first indexed release that has it (unindexed releases may lie in between).",
      +  "title": "First Version With"
      +}
    • addedOutput schema / $defs / Finding / properties / internal
      Added value: +{
      +  "default": false,
      +  "description": "True when the name isn't public API: a private name, a name a module imports for its own use, or a name in a private module. Code that uses one, usually another library, breaks when it changes, with no deprecation first.",
      +  "title": "Internal",
      +  "type": "boolean"
      +}
    • addedOutput schema / $defs / Finding / properties / last_version_without
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "For *_not_yet_added: last indexed release without it.",
      +  "title": "Last Version Without"
      +}
    • changedOutput schema / $defs / Replacement / properties / source / description
      Previous value: -"deprecation_message: the library's deprecation text; moved_heuristic: a removal paired with an addition in the same release; curated: reviewed by hand; error_message: named by the error text you passed, and found in the index."New value: +"deprecation_message: the library's deprecation text; moved_heuristic: a removal paired with an addition in the same release, or with another path that still has the same object; curated: reviewed by hand; error_message: named by the error text you passed, and found in the index."
  5. Changed2 schema fields changedv0.1.4
    • addedOutput schema / $defs / Replacement / properties / source / description
      Added value: +"deprecation_message: the library's deprecation text; moved_heuristic: a removal paired with an addition in the same release; curated: reviewed by hand; error_message: named by the error text you passed, and found in the index."
    • changedOutput schema / $defs / Replacement / properties / source / enum
      Previous value: -[
      -  "deprecation_message",
      -  "moved_heuristic",
      -  "curated"
      -]New value: +[
      +  "deprecation_message",
      +  "moved_heuristic",
      +  "curated",
      +  "error_message"
      +]
  6. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already cover safety (readOnly, idempotent, closed-world), so the bar is lower, yet the description still adds real behavior: the shape of the findings, the precision trade-off of supplying versions, and an honest failure mode (empty findings rather than a guess, with `note` and `not_covered` to inspect). That failure-mode disclosure is exactly the kind of 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?

Front-loaded with the trigger condition, then the return contents, then the caveats — the ordering matches how an agent needs the information. The middle sentence enumerating return fields is a long list that partly overlaps the output schema, which is the only place words are spent without full payback.

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?

For a four-parameter, fully documented tool with an output schema and annotations, the description supplies the trigger, the expected payoff, the precision lever, and the failure semantics. Nothing an agent needs in order to call it correctly and interpret the result is missing.

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 100%, so the baseline is 3; the description exceeds it by explaining that `installed_versions` is what makes the answer exact rather than heuristic, which is a rationale the schema's bare example does not give. The remaining parameters (traceback, pip_freeze, min_confidence) carry their meaning entirely in the schema, so no additional lifting is done for them.

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 precise trigger condition by naming concrete error classes (ImportError, ModuleNotFoundError, AttributeError, TypeError) with sample messages, so an agent can decide in one read whether the current failure is in scope. The failure-driven framing also distinguishes it from the sibling tools (check_symbols, check_upgrade, diff_versions), which are keyed to symbols or versions rather than to a raised traceback.

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 explicit call conditions and one usage tip that affects correctness ('pass installed versions for an exact answer'). It stops short of stating when not to use it or naming a preferred alternative for non-error questions, so it falls just below the 5 bar.

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