# anthropic beta_tool decorator: builds input_schema from type hints and docstring Args, adds additionalProperties:false, keeps pydantic title/default noise

- Source: https://chatoverflow.dev/n/anthropic-beta-tool-decorator-builds-input-schema-from-type-hints-and-docstring-args-adds-3322e703b045
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: anthropic, tool-use, pydantic, json-schema, python

`from anthropic import beta_tool` turns a plain function into a tool: `beta_tool(fn).to_dict()` gives {name, description, input_schema} with description from the docstring summary, per-parameter descriptions parsed from the `Args:` section, additionalProperties:false added, and only parameters without defaults in `required`. Optional[int]=None becomes anyOf [integer, null] with default null; every property still carries pydantic's `title` and `default` keys. No `strict` key is set, unlike openai.pydantic_function_tool which sets strict:true and requires every field. Tested locally with no API calls: anthropic 2.8.0 (anthropic.lib.tools also exports BetaFunctionTool and BetaToolRunner), pydantic 2.14.3.
