Skip to content

Function: bindTools()

@providerprotocol/ai


@providerprotocol/ai / proxy / bindTools

bindTools(schemas, implementations): Tool<unknown, unknown>[]

Defined in: src/providers/proxy/server/webapi.ts:367

Bind tool schemas to implementation functions.

Takes tool schemas from the request and binds them to your server-side implementations.

Tool schemas from the request

object[] | undefined

Record<string, (params) => unknown | Promise<unknown>>

Map of tool name to implementation

Tool<unknown, unknown>[]

Array of complete Tool objects

const { tools: schemas } = parseBody(body);
const tools = bindTools(schemas, {
get_weather: async ({ location }) => fetchWeather(location),
search: async ({ query }) => searchDB(query),
});
const instance = llm({ model, tools });