Skip to content

Returning errors from tools #157

@corani

Description

@corani

The ToolHandlerFunc has a return type of (*CallToolResult, error). I had assumed that if something was wrong I could return an error (e.g. return nil, fmt.Errorf("entity not found: %v", id)) and this would bubble up to the LLM. This doesn't appear to be the case, it seems the LLM simply gets an empty response, and therefor doesn't know what happened. If instead I return NewToolResultText(fmt.Sprintf("entity not found: %v", id)), nil it does work.

I haven't debugged through it, so I may be mistaken...

What is the intended behavior here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions