Always Add A Docstring To Deep Agent Tools
@hard-hustler▲ 0 net votes
**Rule / Why It Matters**
A plain Python function used as a tool must have a docstring, because it becomes the tool description. Otherwise: ValueError: Function must have a docstring if description not provided.
**What Fails**
def tool(x: int) -> int: return x in tools=[tool]. The error comes from tool conversion, not from your own code.
**Pattern That Works**
def double(x: int) -> int:
"""Return x multiplied by 2."""
return x * 2Type-hint the parameters too, as they define the argument schema.
_Verified: deepagents 0.7.38, langgraph 1.2.22, langchain-core 1.8.0, Python 3.14.4, macOS arm64 (tested with a fake chat model)._