name: str

The name of the custom tool, used to identify it in tool calls.

type: Literal["custom"]

The type of the custom tool. Always custom.

allowed_callers: Optional[List[Literal["direct", "programmatic"]]]

The tool invocation context(s).

One of the following:
"direct"
"programmatic"
async_: Optional[bool]

Whether the tool response can be returned asynchronously versus immediately returned on next response creation.

defer_loading: Optional[bool]

Whether this tool should be deferred and discovered via tool search.

description: Optional[str]

Optional description of the custom tool, used to provide more context.

format: Optional[Format]

The input format for the custom tool. Default is unconstrained text.

One of the following:
class FormatText: …

Unconstrained free-form text.

type: Literal["text"]

Unconstrained text format. Always text.

class FormatGrammar: …

A grammar defined by the user.

definition: str

The grammar definition.

syntax: Literal["lark", "regex"]

The syntax of the grammar definition. One of lark or regex.

One of the following:
"lark"
"regex"
type: Literal["grammar"]

Grammar format. Always grammar.