Skip to content
providerkit
GitHub

planHostedTools

function planHostedTools(
provider,
wire,
opts
): HostedTool[];

Defined in: core/src/hosted/shared.ts:63

The hosted tools one request sends: each tool the caller asked for that this wire can send with every field it set. One it can’t is refused with an invalid error before any request, unless it is optional, which drops it.

toolChoice: "none" sends none, on every wire. A forced choice (required or a named tool) with hosted tools is refused: Anthropic’s any and Responses’ required can be met by a vendor tool, Gemini’s ANY cannot, so the pair has no one meaning. A type listed twice is refused everywhere.

Ported from PydanticAI (MIT, Pydantic Services Inc.): the refusal rule and optional, models/init.py:4080-4130 and native_tools/init.py:155-207.

Parameter Type
provider string
wire HostedWire
opts Pick<StreamOptions, "hostedTools" | "toolChoice">

HostedTool[]