ai.tools.raw_tool

The constructor for tools whose schema does not derive from a BAML signature: the caller supplies the JSON Schema and a handler over the raw argument map. This is how dynamic tool sources (MCP servers) become ordinary tools.

Reference version

Signature

function ai.tools.raw_tool(
name: string,
description: string,
input_schema: map<string, unknown>,
handler: (map<string, unknown>) -> string throws unknown,
on_error: ai.tools.ErrorMode | null = …
) -> ai.tools.Tool throws baml.errors.InvalidArgument

The constructor for tools whose schema does not derive from a BAML signature: the caller supplies the JSON Schema and a handler over the raw argument map. This is how dynamic tool sources (MCP servers) become ordinary tools.

Source:<builtin>/ai/ns_tools/tools.bamlbytes 32693819