# Query tool details

Read the current workspace tool or readable system tool. The detailed response contains the input and output Schema.

```text
GET https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/tools/{tool_id}
```

## Before you call

First [query the tool list](list-tools.md) to obtain the tool ID. Prepare a personal access token and target workspace ID that has access to the target workspace.

The example below uses:

- `$AI_STUDIO_API_KEY`: The actual personal access token, passed through the `X-API-Key` Header.
- `$WORKSPACE_ID`: Target workspace ID, passed through `X-Workspace-ID` Header.
- `$TOOL_ID`: Tool ID to be queried.

## Request example

```bash
curl "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/tools/$TOOL_ID" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

## Path parameters

| Parameters | Type | Is it required | Description |
| --- | --- | --- | --- |
| `workspace_id` | string | Yes | The current workspace ID. |
| `tool_id` | string | Yes | The tool ID to be queried. |

## Query parameters

| Parameters | Type | Is it required | Description |
| --- | --- | --- | --- |
| `tool_workspace_id` | string | No | ID of the workspace to which the tool belongs. If not provided, the current workspace is used; only the current workspace or the system workspace can be specified. |

## Successful response

Returns `200` on success.

```json
{
  "code": 0,
  "data": {
    "id": "tool_01",
    "workspace_id": "ws_01",
    "name": "查询工具",
    "status": "active",
    "kind": "http_api",
    "input_schema": {},
    "output_schema": {},
    "side_effect_class": "read",
    "version": 1,
    "bindable": true,
    "supported_runtimes": []
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | `0` on success. |
| `data.id` | string | Tool ID, workspace and name. |
| `data.workspace_id` | string | Tool ID, workspace and name. |
| `data.name` | string | Tool ID, workspace and name. |
| `data.status` | string | Tool status, category and classification. |
| `data.kind` | string | Tool status, category and classification. |
| `data.category` | string | Tool status, category and classification. |
| `data.input_schema` | object | Tool input and output Schema. |
| `data.output_schema` | object | Tool input and output Schema. |
| `data.side_effect_class` | string | The side effects classification of the tool. |
| `data.credential_ref` | string | Credentials, approval and desensitization policy references; not returned if not set. |
| `data.approval_policy_ref` | string | Credentials, approval and desensitization policy references; not returned if not set. |
| `data.redaction_policy_ref` | string | Credentials, approval and desensitization policy references; not returned if not set. |
| `data.bindable` | boolean | Current binding capabilities, reasons for unbinding, and supported operating environments. |
| `data.bindability_reason` | string | Current binding capabilities, reasons for unbinding, and supported operating environments. |
| `data.supported_runtimes` | string[] | Current binding capabilities, reasons for unbinding, and supported operating environments. |
| `data.version` | integer | Tool version and creation, latest update time. |
| `data.created_at` | string | Tool version, creation, and latest update time. |
| `data.updated_at` | string | Tool version, creation, and latest update time. |

`[]` after a type denotes an array. `[]` in a field path denotes each item in an array.


## Error response

```json
{
  "code": 3,
  "message": "tool not found"
}
```

### Common HTTP errors

```{list-table}
:header-rows: 1
:widths: 12 22 32 34

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `2`（`INVALID_ARGUMENT`）
  - Invalid path or `tool_workspace_id`.
  - Check path and query parameters.
* - `401`
  - `6`（`UNAUTHENTICATED`）
  - Lack of valid identity credentials.
  - Check API Key.
* - `403`
  - `5`（`PERMISSION_DENIED`）
  - The current identity does not have permission to read the tool.
  - Check workspace authorization.
* - `404`
  - `3`（`NOT_FOUND`）
  - The tool does not exist within the specified workspace.
  - Check tool ID and belonging workspace.
* - `503`
  - `15`（`UNAVAILABLE`）
  - Tool resource services or authorization dependencies are temporarily unavailable.
  - Try again later.
```

## Follow-up operations

When modifications are needed [Update tool](update-tool.md). When returning the list [Query tool tag](list-tool-tags.md).
