---
url: >-
  https://adk.nht.io/api/@nhtio/adk/spooled_artifact/functions/collectArtifactCompatibleIds.md
---

# Function: collectArtifactCompatibleIds()

```ts
function collectArtifactCompatibleIds(
  ctx: {
    turnRetrievables: Iterable<{
      content: unknown;
      id: string;
      inline: boolean;
    }>;
    turnToolCalls: Iterable<{
      fromArtifactTool?: boolean;
      id: string;
      results: unknown;
    }>;
  },
  requires: SpooledArtifactConstructor,
): string[];
```

Defined in: [src/lib/classes/spooled\_artifact.ts:79](https://github.com/NHTIO/ADK/blob/v1.20260907.0/src/src/lib/classes/spooled_artifact.ts#L79)

Collect artifact IDs from the current turn's tool calls and retrievables that are instances of a specific artifact class.

## Parameters

| Parameter              | Type                                                                                                                                                                                                                  | Description                                                  |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| `ctx`                  | { `turnRetrievables`: `Iterable`<{ `content`: `unknown`; `id`: `string`; `inline`: `boolean`; }>; `turnToolCalls`: `Iterable`<{ `fromArtifactTool?`: `boolean`; `id`: `string`; `results`: `unknown`; }>; } | The dispatch context containing tool calls and retrievables. |
| `ctx.turnRetrievables` | `Iterable`<{ `content`: `unknown`; `id`: `string`; `inline`: `boolean`; }>                                                                                                                                        | -                                                            |
| `ctx.turnToolCalls`    | `Iterable`<{ `fromArtifactTool?`: `boolean`; `id`: `string`; `results`: `unknown`; }>                                                                                                                             | -                                                            |
| `requires`             | [`SpooledArtifactConstructor`](../../forge/type-aliases/SpooledArtifactConstructor.md)                                                                                                                                | The artifact class constructor to filter by.                 |

## Returns

`string`\[]

An array of unique artifact IDs matching the specified class, with collision detection.

## Throws

[@nhtio/adk!E\_ARTIFACT\_ID\_COLLISION](../../exceptions/variables/E_ARTIFACT_ID_COLLISION.md) when the same ID appears in both tool calls and retrievables.
