Skip to content
providerkit
GitHub

HostedTool

type HostedTool = object &
| {
allowedDomains?: readonly string[];
blockedDomains?: readonly string[];
maxUses?: number;
type: "web_search";
userLocation?: UserLocation;
}
| {
allowedDomains?: readonly string[];
blockedDomains?: readonly string[];
maxContentTokens?: number;
maxUses?: number;
type: "web_fetch";
}
| {
fileIds?: readonly string[];
type: "code_execution";
}
| {
maxResults?: number;
storeIds: readonly string[];
type: "file_search";
}
| {
background?: "auto" | "opaque" | "transparent";
format?: "png" | "jpeg" | "webp";
quality?: "auto" | "low" | "medium" | "high";
size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
type: "image_generation";
};

Defined in: core/src/hosted/types.ts:32

A tool the model vendor runs inside its own turn.

Which wire runs which type, and which fields each applies, is in the hosted tools guide. A type the endpoint doesn’t run, or a field the wire can’t apply, is refused with an invalid error before any request goes out. Set optional to drop the tool there instead.

optional optional?: boolean;

Drop this tool, rather than refuse the request, where the endpoint can’t run it or can’t apply one of its fields. The whole tool goes, never one field: sending it without a domain filter or a use cap would widen what the vendor does, and leaving it out only narrows it.