previewToolSelection
previewToolSelection(
options:object):Promise<{clientToolNames:string[];serverToolNames:string[]; }>
Defined in: src/react/useChatStorage.ts:301
Preview which tools useChatStorage will include for a given prompt,
without making the actual chat request.
Runs the exact same client + server tool selection pipeline that
useChatStorage’s sendMessage runs internally — same embedding,
same autoFilterClientTools call, same server-tools branch — so the
returned names are guaranteed to match what a real request would
include for that prompt + config.
Intended for debug UIs (“show me what the model will see for this
prompt”). Pass the same clientTools, serverToolsFilter,
extraToolSets, and activeToolSets you pass to useChatStorage
so the result is faithful.
Caveats:
- For server tools, this only mirrors the dynamic
findMatchingToolspath (the one used for the responses API insendMessage). If your serverToolsFilter is a function, it’s invoked directly with the prompt embedding. - Embedding generation hits the same
/embeddingsendpoint as the real request; pass a sharedclientToolEmbeddingsCacheif you call this repeatedly to avoid re-embedding tool descriptions.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
|
|
‐ |
|
|
|
‐ |
|
|
|
‐ |
|
|
|
Optional cache of tool-description embeddings, shared across calls. |
|
|
‐ | |
|
|
|
‐ |
|
|
|
‐ |
|
|
() => |
‐ |
|
|
|
‐ |
|
|
{ |
‐ |
|
|
|
‐ |
|
|
|
‐ |
Returns
Promise<{ clientToolNames: string[]; serverToolNames: string[]; }>