# build_tool_use_payload

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/_tool_stream/build_tool_use_payload)

Build the `tool.use` hook payload (schema documented in `hooks`).

## Signature

```python
build_tool_use_payload(
    tool_name: str,
    tool_id: str,
    tool_args: dict[str, Any],
) -> ToolUsePayload
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `tool_name` | `str` | Yes | The tool being invoked. |
| `tool_id` | `str` | Yes | The tool-call id. Always a real id for an emitted `tool.use` (a call with no id never produces one). |
| `tool_args` | `dict[str, Any]` | Yes | The parsed tool-call arguments. |

## Returns

`ToolUsePayload`

The `tool.use` payload dict.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/e14e0adcbe78565ed3650e7f24b2a775d5437d25/libs/code/deepagents_code/_tool_stream.py#L619)