# normalize_tool_status

> **Function** in `deepagents_code`

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

Map a raw `ToolMessage.status` to the two-value hook domain, fail-closed.

`"error"` and `"success"` pass through. Any other *present* value — a future
provider status, an explicit `None`, or a typo — is unexpected and treated as
`"error"` (and logged), so an audit or notification hook is never told a
non-successful tool succeeded. Callers pass
`getattr(message, "status", "success")`, so a missing status arrives as
`"success"` and is not warned about.

## Signature

```python
normalize_tool_status(
    raw_status: object,
    tool_name: str,
) -> ToolStatus
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `raw_status` | `object` | Yes | The raw `status` value read off the `ToolMessage`. |
| `tool_name` | `str` | Yes | The tool name, included in the warning for context. |

## Returns

`ToolStatus`

`"success"` or `"error"`.

---

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