In short.
Set Tool Metadata is a Pydantic AI guide for Python developers labeling tools used by an AI agent, but it does not demonstrate how those labels change the agent's behavior. Its example configures SetToolMetadata, registers two tools, and includes assertions inspecting the tool definitions recorded by TestModel. The example has not been executed; version compatibility and behavior beyond the example are not assessed.
Researched and written by an AI model and checked by a second AI model. How it works
Coverage is the complete captured page at [https://pydantic.dev/docs/ai/capabilities/set-tool-metadata/index.md], including its example, documentation-index notice and agent-query notices. Those notices provide no additional evidence about feature behavior. Linked pages are excluded. No code was executed; installation, runtime results, external-provider behavior, downstream enforcement and performance remain unverified.
The overview
identity
This feature guide documents the SetToolMetadata capability in Pydantic AI at [https://pydantic.dev/docs/ai/capabilities/set-tool-metadata/index.md]. Metadata means key-value labels attached to tool definitions so that other capabilities or custom application logic can inspect them.
assessment
The guide is useful for understanding how to attach a label to a specific tool and inspect its presence. Its practical scope is narrow: it demonstrates metadata assignment, while the code that would respond to that metadata is left to the reader. A sensitive=True label alone does not demonstrate approval requirements, restricted access or other protective behavior.
users
The guide suits Python developers already defining Pydantic AI tools, particularly those preparing configuration for another capability or custom logic. Beginners get a small example with search and greet functions, although the explanation assumes some familiarity with agents, decorators and inspecting Python objects.
capabilities
SetToolMetadata merges metadata key-value pairs onto selected tools. The example uses tools=['search'] to select the search tool and sensitive=True to supply its label. The page also identifies toolset-level .with_metadata() as another way to achieve the same effect.
Using it
requirements
The example needs a Python environment providing Agent, SetToolMetadata and TestModel through pydantic_ai. It constructs TestModel without API credentials or external-provider configuration. The page does not specify supported Python versions, a required Pydantic AI release, installation dependencies or requirements for using a real model provider.
mechanism
The Agent receives capabilities=[SetToolMetadata(tools=['search'], sensitive=True)] during construction. Two functions are then registered with @agent.tool_plain. Following agent.run_sync(), the example inspects TestModel.last_model_request_parameters.function_tools to find the definitions by name and examine their metadata.
The page establishes that metadata is available for other capabilities or custom logic to inspect. It does not explain which components consume particular keys or whether any metadata is exposed to an external model.
setup
The documented sequence is to import the three classes, create TestModel, construct the Agent with SetToolMetadata, and register search and greet. The page supplies a complete script named set_tool_metadata.py and describes it as runnable as supplied. Installation instructions and an environment configuration are absent, and that execution claim has not been independently verified.
example
The script submits 'Search for pydantic' through agent.run_sync(). Its assertions are designed to check that request parameters exist, search has sensitive=True, and greet either has no metadata or returns None when its sensitive key is queried.
The search function only returns a formatted results string; it performs no information retrieval. The greet function returns a formatted greeting. These functions keep the example focused on metadata. Nothing was executed, so no assertion results or runtime behavior are confirmed.
Assessment & evidence
limitations
The page does not document how conflicting metadata values are resolved, how multiple metadata capabilities interact, or which selection rules exist beyond the named-tool example. It also provides no performance measurements or real-provider demonstration. The sensitive label has no demonstrated enforcement behavior in the supplied code.
reasoning
The guide's value comes from connecting configuration to inspectable tool definitions: it shows where the label is supplied and how its presence can be checked. For a project considering this feature, the key design question is which capability or application component will read the metadata and what action it will take. That consuming behavior is not demonstrated here.
alternatives
The page explicitly offers .with_metadata() at the toolset level as an alternative and links to [https://pydantic.dev/docs/ai/tools-toolsets/toolsets/#setting-tool-metadata]. That linked documentation is outside this report's scope, so its calling syntax and composition behavior are not assessed. No comparison with other frameworks is provided.
evidence
The evidence consists of the complete Set Tool Metadata documentation page, including its explanatory text and one Python example. It supports the described configuration and intended assertions, but supplies no execution transcript, benchmark or deployment result.
The captured source revision is sha256:03d2a680386e917845438d597ad6ba25898bb67eebe2e47d638ab949bc0873ae. Linked API references and toolset documentation were not included.
Access & freshness
costs
Costs are unknown. The page provides no pricing, usage charges, infrastructure estimates or measurements of metadata overhead. Although the example uses TestModel, the evidence does not establish the cost of a real deployment.
rights
The supplied page states no license or redistribution terms for its documentation or example. Rights to copy, modify or redistribute those materials are not established by this evidence.
freshness
The page was captured on 23 November 2026 at 02:00:47.859 UTC. It states no publication date, update date or applicable Pydantic AI release. The capture time establishes when this text was obtained; compatibility with any particular installed version remains unknown.
actions
Before adopting the pattern, confirm that your installed Pydantic AI version provides the demonstrated APIs. Reproduce the two-tool example in your own environment and inspect both metadata values. Then connect the label to the capability or application logic that needs it, and verify that behavior separately. Check conflict handling before combining overlapping metadata assignments.
