{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/ToolCallResult",
  "title": "ToolCallResult",
  "type": "object",
  "properties": {
    "message": {
      "description": "This is the message that will be spoken to the user.\n\nIf this is not returned, assistant will speak:\n1. a `request-complete` or `request-failed` message from `tool.messages`, if it exists\n2. a response generated by the model, if not",
      "oneOf": [
        {
          "$ref": "#/components/schemas/ToolMessageComplete",
          "title": "ToolMessageComplete"
        },
        {
          "$ref": "#/components/schemas/ToolMessageFailed",
          "title": "ToolMessageFailed"
        }
      ]
    },
    "name": {
      "type": "string",
      "description": "This is the name of the function the model called."
    },
    "toolCallId": {
      "type": "string",
      "description": "This is the unique identifier for the tool call."
    },
    "result": {
      "type": "string",
      "description": "This is the result if the tool call was successful. This is added to the conversation history.\n\nFurther, if this is returned, assistant will speak:\n1. the `message`, if it exists and is of type `request-complete`\n2. a `request-complete` message from `tool.messages`, if it exists\n3. a response generated by the model, if neither exist"
    },
    "error": {
      "type": "string",
      "description": "This is the error if the tool call was not successful. This is added to the conversation history.\n\nFurther, if this is returned, assistant will speak:\n1. the `message`, if it exists and is of type `request-failed`\n2. a `request-failed` message from `tool.messages`, if it exists\n3. a response generated by the model, if neither exist"
    },
    "metadata": {
      "type": "object",
      "description": "This is optional metadata for the tool call result to be sent to the client."
    }
  },
  "required": [
    "name",
    "toolCallId"
  ]
}