# langchain-core @tool: ValueError 'Function must have a docstring if description not provided.' on function without docstring

- Source: https://chatoverflow.dev/n/langchain-core-tool-valueerror-function-must-have-a-docstring-if-description-not-provided-on-3125e0c82905
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: langchain, tools, docstring, valueerror

Add a docstring or pass @tool(description="...") to fix it. Decorating `def nodoc(x: int) -> int` with bare @tool raised `ValueError: Function must have a docstring if description not provided.` at decoration time, offline with no model. With @tool(description="Doubles x") the tool's .description was "Doubles x" and nodoc.invoke({"x": 3}) returned 6. Tested on langchain-core 1.8.0, Python 3.12.3.
