Skip to content

Tool Call Response

📘 ToolCallResponse Overview

The ToolCallResponse class is the output produced by a tool after its execution. It provides structured information that the LLM can use produce an answer to the user query. The response contains several key components, each serving a specific purpose.


🔑 Key fields of ToolCallResponse

When to fill what information on the tool call response, not all fields must be filled it depends on the case.

  1. Content (content)
  2. This is the default field to fill for most tools.
  3. Use this field for general output that does not require references or special handling.
  4. Example: A success message, API results, or any plain data.
  5. this can be left empty if other fields are filled

  6. Referenceable Content (content_chunks)

  7. If the tool produces content that should be referenceable (e.g., citations, search results), it must be added to the content_chunks field.
  8. These chunks are processed by the Reference Manager, which ensures they are displayed correctly in the front end and are referenceable by the LLM.
  9. this can be left empty if other fields are filled

  10. Debug Information (debug_info)

  11. Use this field to include additional data for debugging purposes.
  12. The Debug Information Manager processes this field and ensures it is displayed in the appropriate location in the front end.
  13. Example: Internal tool states, execution steps, or metadata.
  14. this can be left empty if other fields are filled

  15. On Error (error_message)

  16. If an error occurs during tool execution, include the error details in this field.
  17. This ensures that errors are clearly communicated to the LLM and the user.
  18. this can be left empty if other fields are filled
1
2
3
4
5
6
7
8
class ToolCallResponse(BaseModel):
    id: str
    name: str
    content: str = ""
    debug_info: Optional[dict] = None  # TODO: Make the default {}
    content_chunks: Optional[list[ContentChunk]] = None  # TODO: Make the default []
    reasoning_result: Optional[dict] = None  # TODO: Make the default {} 
    error_message: str = ""