> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeroruntime.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Tools & MCP

> Python API reference for Tools & MCP.

Give an agent capabilities beyond conversation: define function tools it can call,
connect MCP servers to expose external tools, and handle DTMF and voicemail on
telephony calls.

## function\_tool

```python theme={null}
def function_tool(func: 'Optional[Callable]' = None, *, name: 'Optional[str]' = None)
```

Expose a function to the model as a callable tool.

Works bare or with arguments. The name, description and parameter schema are
read off the function itself -- its `__name__`, the prose above its
`Args:` block, and its type hints -- so a well-written docstring is what
the model sees.

```python theme={null}
@function_tool
async def lookup_order(order_id: str) -> dict:
    '''Find an order by its id.

    Args:
        order_id: The customer's order number.
    '''
```

Methods on an `Agent` subclass are registered automatically; tools defined
elsewhere go in `Agent(tools=[...])`.

<ParamField path="func" type="Optional[Callable]">
  The function, when used bare.
</ParamField>

<ParamField path="name" type="Optional[str]">
  Override the exposed name. Everything else the model is told comes off the function itself, so this is the only knob.
</ParamField>

<ResponseField name="returns">
  The function, marked as a tool.
</ResponseField>

***

## MCPServerStdio

A local MCP server, run as a subprocess and spoken to over stdio.

### Fields

<ParamField path="executable_path" type="str" required>
  The program to run, e.g. `sys.executable`.
</ParamField>

<ParamField path="process_arguments" type="List[str]" default="…">
  Its arguments -- typically the server script.
</ParamField>

<ParamField path="environment_vars" type="Optional[Dict[str, str]]">
  Environment for the child. `None` inherits this process's, which is usually what you want: the server needs the same API keys you already have.
</ParamField>

<ParamField path="working_directory" type="Optional[Union[str, Path]]">
  Directory to run it in.
</ParamField>

<ParamField path="session_timeout" type="float" default="5.0">
  Seconds to wait for the connection and for each tool call. The vendor's default is 5, which is tight for a server that starts an interpreter; its own examples pass 30.
</ParamField>

<ParamField path="type" type="str" default="stdio">
  Always `stdio`. Set for you -- it is what tells the SDK which transport to connect with.
</ParamField>

***

## MCPServerHTTP

A remote MCP server, reached over HTTP.

### Fields

<ParamField path="endpoint_url" type="str" required>
  The server's URL.
</ParamField>

<ParamField path="request_headers" type="Optional[Dict[str, str]]">
  Sent with every request -- an API key usually lives here. Read in this process, so the credential stays with you.
</ParamField>

<ParamField path="connection_timeout" type="float" default="10.0">
  Seconds to wait for the connection.
</ParamField>

<ParamField path="stream_read_timeout" type="float" default="300.0">
  Seconds a quiet stream may stay open. Long by default: an MCP server that has nothing to say is not broken.
</ParamField>

<ParamField path="session_timeout" type="float" default="5.0">
  Seconds to wait for the session, and for each tool call.
</ParamField>

<ParamField path="type" type="str" default="http">
  Always `http`. Set for you.
</ParamField>
