# Tools
```python
from langchain.tools import tool, ToolRuntime
@tool
def get_weather(city: str) -> str:
"""Get weather for a given city."""
return f"It is always sunny in {city}!"
```
Tool with runtime access (state, context, store):
```python
@tool
def get_last_user_message(runtime: ToolRuntime) -> str:
"""Read the most recent user message."""
return runtime.state["messages"][-1].content
```
## Rules
- `runtime` is reserved for the ToolRuntime parameter. Naming your own argument `config` or `runtime` breaks the injection; use the ToolRuntime annotation instead.
- The docstring is the tool description the model sees. Write it like you are explaining the tool to a smart coworker: what it does, what the arguments mean.
- Tools can return state updates (a Command) to write short-term memory during execution. See the agent-with-memory workflow skill.