# ToolCallTransformer

> **Class** in `langgraph.prebuilt`

📖 [View in docs](https://reference.langchain.com/python/langgraph.prebuilt/_tool_call_transformer/ToolCallTransformer)

Project `tools` channel events into `ToolCallStream` handles.

Each `tool-started` event spawns a `ToolCallStream`, pushed onto
`run.tool_calls`. Subsequent `tool-output-delta` events append to
that stream's deltas log; `tool-finished` and `tool-error` close it.

Native transformer — the `tool_calls` projection is exposed as a
direct attribute on the run stream.

A nameless `StreamChannel[ToolCallStream]` is used (no protocol
auto-forwarding) because the live handles are not serializable and
should not be injected into the main event log. Wire consumers
subscribe to the `tools` channel instead, where the raw protocol
events flow through untouched by this transformer (`process`
returns `True`).

Registered explicitly by users at compile time via
`builder.compile(transformers=[ToolCallTransformer])` — not a
default built-in, so the `tools` channel is user-opt-in.

## Signature

```python
ToolCallTransformer(
    self,
    scope: tuple[str, ...] = (),
)
```

## Extends

- `StreamTransformer`

## Constructors

```python
__init__(
    self,
    scope: tuple[str, ...] = (),
) -> None
```

| Name | Type |
|------|------|
| `scope` | `tuple[str, ...]` |


## Properties

- `required_stream_modes`

## Methods

- [`init()`](https://reference.langchain.com/python/langgraph.prebuilt/_tool_call_transformer/ToolCallTransformer/init)
- [`process()`](https://reference.langchain.com/python/langgraph.prebuilt/_tool_call_transformer/ToolCallTransformer/process)
- [`finalize()`](https://reference.langchain.com/python/langgraph.prebuilt/_tool_call_transformer/ToolCallTransformer/finalize)
- [`fail()`](https://reference.langchain.com/python/langgraph.prebuilt/_tool_call_transformer/ToolCallTransformer/fail)

---

[View source on GitHub](https://github.com/langchain-ai/langgraph/blob/aa322c13cd5f16a3f6254a931a4104e412cd687c/libs/prebuilt/langgraph/prebuilt/_tool_call_transformer.py#L44)