---
title: "Get tool invocations"
method: GET
path: "/v1/{organization}/tool/invocation"
tags: ["Tool"]
---

# Get tool invocations

`GET /v1/{organization}/tool/invocation`

Retrieve tool invocations under the specified filters.

#### Permissions
This endpoint may require the following permission:
* `Conversation:GetInteractionInsights` for `ToolInvocation`s from a regular conversation.
* `Simulation:GetSimulationUnitTestSetRun` for `ToolInvocation`s from a simulation conversation.

## Path parameters

- `organization` string, required

## Query parameters

- `tool_id` string[] — The IDs of the tools to get invocations for.
- `version` string[] — A list of semver constraints that specifies the versions to retrieve in the [Python packaging specification](https://packaging.python.org/en/latest/specifications/version-specifiers/#id5). This must be the exact same length as `tool_id`, and each entry corresponds to the tool ID at the same index.
- `invocation_source_type` string[] — The source types of the invocations.
- `conversation_id` string[] — The conversation IDs associated with the invocations if they are of invocation source `regular-conversation`.
- `simulation_unit_test_set_run_id` string[] — The simulation unit test set run IDs associated with the invocations if they are of invocation source `simulation-conversation`.
- `succeeded` boolean, nullable — Whether the invocation succeeded.
- `limit` integer — The maximum number of tool invocations to retrieve.
- `continuation_token` integer — The token from the previous request to return the next page of tool invocations.
- `sort_by` string[] — The fields to sort the sets by. Supported fields are `created_at`, `version.major`, `version.minor`, `version.patch`, `tool_id`, `invocation_source.type`, and `invocation_status.succeeded`. Specify a `+` before the field name to indicate ascending sorting and `-` for descending sorting. Multiple fields can be specified to break ties.

## Headers

- `x-mongo-cluster-name` string, nullable — The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
- `Sec-WebSocket-Protocol` string[]

## Response `200`

Succeeded.

- SrcAppEndpointsToolGetToolInvocationsResponse
  - `tool_invocations` ToolInvocationInstance[], required — The list of tool invocations.
    - `id` string, required — The ID of the tool invocation.
    - `org_id` string, required — The ID of the organization.
    - `created_at` string, date-time
    - `updated_at` string, date-time
    - `invocation_status` union, required
      - SucceededInvocationStatus
        - `succeeded` true
        - `output` string, required — The output produced by the tool invocation.
      - FailedInvocationStatus
        - `succeeded` false
        - `exception_message` string, required — The exception message if the tool invocation failed.
        - `exception_type` string, required — The exception type if the tool invocation failed.
        - `exception_stack_trace` string[], required — The exception stack trace if the tool invocation failed.
    - `invocation_source` union, required
      - RegularConversationInvocationSource
        - `type` 'regular-conversation'
        - `user_id` string, required — The ID of the user whose conversation invoked the tool.
        - `conversation_id` string, nullable, required — The ID of the conversation where the tool was invoked. This conversation might not actually exist if later in the call the conversation is rolled back.
        - `interaction_id` string, nullable, required — The ID of the interaction where the tool was invoked. This interaction might not actually exist if later in the call the interaction is rolled back.
        - `invocation_metadata` union, required
          - StateTransitionInvocationMetadata
            - `type` 'state-transition'
            - `current_state_machine_and_version` unknown[], required — The ID and version of the state machine that is currently being executed.
              - …
            - `state_name` string, required — The name of the state during which the tool was invoked.
            - `state_transition_index` integer, required — The index of the state transition during which the tool was invoked. As an example, the first state processing that occurs during this state machine navigation process has index 1.
            - `tool_call_round_index` integer, required — The index of the tool call round.
          - EngageUserInvocationMetadata
            - `type` 'engage-user'
            - `current_state_machine_and_version` unknown[], required — The ID and version of the state machine that is currently being executed.
              - …
            - `tool_call_round_index` integer, required — The index of the tool call round.
          - ToolCallStateInvocationMetadata
            - `type` 'tool-call-state'
            - `current_state_machine_and_version` unknown[], required — The ID and version of the state machine that is currently being executed.
              - …
            - `state_name` string, required — The name of the state during which the tool was invoked.
      - SimulationConversationInvocationSource
        - `type` 'simulation-conversation'
        - `simulation_unit_test_set_run_id` string, nullable, required
        - `unit_test_id` string, nullable, required
        - `run_index` integer, nullable, required
        - `invocation_metadata` union, required
          - StateTransitionInvocationMetadata
            - `type` 'state-transition'
            - `current_state_machine_and_version` unknown[], required — The ID and version of the state machine that is currently being executed.
              - …
            - `state_name` string, required — The name of the state during which the tool was invoked.
            - `state_transition_index` integer, required — The index of the state transition during which the tool was invoked. As an example, the first state processing that occurs during this state machine navigation process has index 1.
            - `tool_call_round_index` integer, required — The index of the tool call round.
          - EngageUserInvocationMetadata
            - `type` 'engage-user'
            - `current_state_machine_and_version` unknown[], required — The ID and version of the state machine that is currently being executed.
              - …
            - `tool_call_round_index` integer, required — The index of the tool call round.
          - ToolCallStateInvocationMetadata
            - `type` 'tool-call-state'
            - `current_state_machine_and_version` unknown[], required — The ID and version of the state machine that is currently being executed.
              - …
            - `state_name` string, required — The name of the state during which the tool was invoked.
    - `duration_ms` integer, required — The duration of the tool invocation in milliseconds.
    - `tool_id` string, required — The ID of the tool that was invoked.
    - `tool_version` Version, required
      - `major` integer, required
      - `minor` integer, required
      - `patch` integer, required
    - `inputs` object, required — The input parameters to the tool.
  - `has_more` boolean, required — Whether there are more tool invocations to retrieve.
  - `continuation_token` unknown, required

## Other responses

- `400` — The `tool_id` and `version` query parameters are not the same length.
- `401` — Invalid authorization credentials.
- `403` — Missing required permissions.
- `404` — Specified organization does not exist.
- `422` — Invalid request path parameter or request query parameter failed validation.
- `429` — The user has exceeded the rate limit of 50 requests per minute for this endpoint.
- `503` — The service is going through temporary maintenance.

---

[API](https://skmtc.net/amigo/apis/amigo-api.md) · [All operations](https://skmtc.net/amigo/apis/amigo-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/amigo/amigo-api/revisions/f0f28319e448/schema)
