# ToolCall

> Tool calls: every integration run, capability call and agent tool call your platform work made, newest first.

```python
page = noclick.ToolCall.list_page(tool="gmail.*", status="error", user_filter=noclick.ALL_USERS)
```

## ToolCall

```typescript
class ToolCall
```

One recorded tool call.

| Attribute | Type | Description |
| --- | --- | --- |
| `id` | `string` |  |
| `toolName` | `string` | The name policy judges it by: dotted (`gmail.send_email_message`), or a capability's own (`search`, `fetch`, an agent's too). |
| `toolType` | `string | null` |  |
| `operation` | `string | null` |  |
| `status` | `string | null` |  |
| `error` | `string | null` |  |
| `arguments` | `JsonObject` |  |
| `resultPreview` | `string | null` |  |
| `durationMs` | `number | null` |  |
| `credentialId` | `string | null` |  |
| `userId` | `string | null` |  |
| `agentId` | `string | null` |  |
| `conversation` | `string | null` |  |
| `executionId` | `string | null` |  |
| `source` | `string | null` | `api`, `agent` or `mcp_server`. |
| `createdAt` | `Date | null` |  |
| `raw` | `JsonObject` | The response JSON exactly as the API sent it. |
| `mcpServerId` | `string | null` | The hosted MCP server an MCP client called it through (`source` `mcp_server`). |
| `connection` | `string | null` | The connection it ran on, as the account names it (a named connection's name, else its name in the app). |

Types:

```typescript
type JsonObject = { [key: string]: unknown };
```

### ToolCall.list

```typescript
static list(options?: ToolCallFilters & { limit?: number }): Promise<ToolCall[]>
```

Every matching call (or the first `limit`).

Parameters:

- `options.agent` (`string | ApiObject`): An `Agent` or agent id: its turns' calls.
- `options.tool` (`string`): A tool name or a `*` pattern (`gmail.*`), dotted or wire form.
- `options.status` (`"success" | "error"`)
- `options.source` (`"api" | "agent" | "mcp_server"`): `api`: your own calls; `agent`: your agents' turns; `mcp_server`: MCP clients' calls through your hosted servers.
- `options.since` (`Date | string`)
- `options.until` (`Date | string`)
- `options.limit` (`number`): Return at most this many.
- `options.userFilter` (`UserFilter`): Which users the read covers (`user_id` query), instead of acting as one (`user`).
- `options.user` (`UserOption`, default: the current user): `undefined` = the ambient user (`asUser`), `null` = the account itself.
- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: Every matching call, newest first, fetched page by page.

Types:

```typescript
/**
 * Which users a read covers: `ALL_USERS`, `NO_USER`, a `User` or your id for one. Sent as the
 * `user_id` query parameter, never as the `NoClick-User` header, so it filters without acting as the user.
 */
type UserFilter = typeof ALL_USERS | typeof NO_USER | UserRef;

/** A `User` or your own id for the user. */
type UserRef = string | UserLike;

/** Anything that can name a user lazily (a `User`). */
interface UserLike {
  _userId(): Promise<string>;
}

/** `undefined` = the ambient user (from `asUser`), `null` = the account itself. */
type UserOption = UserRef | null | undefined;
```

### ToolCall.listPage

```typescript
static listPage(
  options?: ToolCallFilters & PageOptions,
): Promise<Page<ToolCall>>
```

One page of matching calls; pass `nextCursor` back as `cursor`.

Parameters:

- `options.cursor` (`string | null`): The `next_cursor` of the page before; omit it for the first page.
- `options.limit` (`number`): Return at most this many.
- `options.agent` (`string | ApiObject`): An `Agent` or agent id: its turns' calls.
- `options.tool` (`string`): A tool name or a `*` pattern (`gmail.*`), dotted or wire form.
- `options.status` (`"success" | "error"`)
- `options.source` (`"api" | "agent" | "mcp_server"`): `api`: your own calls; `agent`: your agents' turns; `mcp_server`: MCP clients' calls through your hosted servers.
- `options.since` (`Date | string`)
- `options.until` (`Date | string`)
- `options.userFilter` (`UserFilter`): Which users the read covers (`user_id` query), instead of acting as one (`user`).
- `options.user` (`UserOption`, default: the current user): `undefined` = the ambient user (`asUser`), `null` = the account itself.
- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: A page whose `data` holds up to `limit` calls (at most 200) and whose `next_cursor`
is `None` on the last page.

Types:

```typescript
/**
 * Which users a read covers: `ALL_USERS`, `NO_USER`, a `User` or your id for one. Sent as the
 * `user_id` query parameter, never as the `NoClick-User` header, so it filters without acting as the user.
 */
type UserFilter = typeof ALL_USERS | typeof NO_USER | UserRef;

/** A `User` or your own id for the user. */
type UserRef = string | UserLike;

/** Anything that can name a user lazily (a `User`). */
interface UserLike {
  _userId(): Promise<string>;
}

/** `undefined` = the ambient user (from `asUser`), `null` = the account itself. */
type UserOption = UserRef | null | undefined;
```

### ToolCall.summary

```typescript
static summary(options?: ToolCallFilters): Promise<ToolCallSummary>
```

How many calls match, and how many of them errored.

Parameters:

- `options.agent` (`string | ApiObject`): An `Agent` or agent id: its turns' calls.
- `options.tool` (`string`): A tool name or a `*` pattern (`gmail.*`), dotted or wire form.
- `options.status` (`"success" | "error"`)
- `options.source` (`"api" | "agent" | "mcp_server"`): `api`: your own calls; `agent`: your agents' turns; `mcp_server`: MCP clients' calls through your hosted servers.
- `options.since` (`Date | string`)
- `options.until` (`Date | string`)
- `options.userFilter` (`UserFilter`): Which users the read covers (`user_id` query), instead of acting as one (`user`).
- `options.user` (`UserOption`, default: the current user): `undefined` = the ambient user (`asUser`), `null` = the account itself.
- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.

Returns: The `total`, split into `success` and `error`.

Types:

```typescript
/**
 * Which users a read covers: `ALL_USERS`, `NO_USER`, a `User` or your id for one. Sent as the
 * `user_id` query parameter, never as the `NoClick-User` header, so it filters without acting as the user.
 */
type UserFilter = typeof ALL_USERS | typeof NO_USER | UserRef;

/** A `User` or your own id for the user. */
type UserRef = string | UserLike;

/** Anything that can name a user lazily (a `User`). */
interface UserLike {
  _userId(): Promise<string>;
}

/** `undefined` = the ambient user (from `asUser`), `null` = the account itself. */
type UserOption = UserRef | null | undefined;
```

## ToolCallSummary

```typescript
interface ToolCallSummary
```

How many calls match, and how many of them errored.

| Attribute | Type | Description |
| --- | --- | --- |
| `total` | `number` |  |
| `success` | `number` |  |
| `error` | `number` |  |
| `raw` | `JsonObject` | The response JSON exactly as the API sent it. |

Types:

```typescript
type JsonObject = { [key: string]: unknown };
```
