Skip to content

Add structured error codes to tool failure responses #8

@patmakesapps

Description

@patmakesapps

Problem

When a tool fails, the error message is sometimes just a raw {"error": "..."} string. This makes it harder for the model to recover gracefully.

Proposed solution

  • Define a standard error response format with error codes, categories, and human-readable messages.
  • Apply this format consistently across all tools.

Implementation notes

  • Create an ErrorCode enum in core/errors.py.
  • Define categories like FILE_NOT_FOUND, PERMISSION_DENIED, INVALID_INPUT, TIMEOUT.
  • Return structured error dicts with code, message, recoverable, and suggestion fields.

Acceptance criteria

  • All tool errors return a structured error dict with at least code and message.
  • Error codes are documented.
  • The model can distinguish between recoverable and non-recoverable errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions