Skip to content

docs(tutorials): fix MCPToolset reference links and remote server example#62

Open
Adam-D-Lewis wants to merge 2 commits into
mainfrom
agent-tutorial-mcp-followup
Open

docs(tutorials): fix MCPToolset reference links and remote server example#62
Adam-D-Lewis wants to merge 2 commits into
mainfrom
agent-tutorial-mcp-followup

Conversation

@Adam-D-Lewis

Copy link
Copy Markdown
Member

Follow-up to #59 — these small fixes to the agent tutorial were inadvertently left out before that PR merged.

  • Point the MCPToolset reference links at the proper API anchor (https://ai.pydantic.dev/api/mcp/#pydantic_ai.mcp.MCPToolset) instead of the generic client guide page.
  • Expand the remote MCP server snippet to show the full toolsets config block, matching the rest of the tutorial.

…mple

Point the MCPToolset reference links at the proper API anchor instead of
the generic client guide page, and expand the remote MCP server snippet to
show the full toolsets config block.
@Adam-D-Lewis Adam-D-Lewis requested a review from pmeier June 26, 2026 15:36

@pmeier pmeier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linking to the correct objects in our or external API references is completely automated by mkdocstrings. Please just use this syntax across the whole tutorial

Comment thread docs/tutorials/agents.py Outdated

# %% [markdown]
# Second, an MCP server. pydantic-ai connects to one with [`MCPToolset`](https://ai.pydantic.dev/mcp/client/), and
# Second, an MCP server. pydantic-ai connects to one with [`MCPToolset`](https://ai.pydantic.dev/api/mcp/#pydantic_ai.mcp.MCPToolset), and

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not link that as Python ref?

Suggested change
# Second, an MCP server. pydantic-ai connects to one with [`MCPToolset`](https://ai.pydantic.dev/api/mcp/#pydantic_ai.mcp.MCPToolset), and
# Second, an MCP server. pydantic-ai connects to one with [pydantic_ai.mcp.MCPToolset][], and

Comment thread docs/tutorials/agents.py Outdated
# [configuration import mechanism](../../references/config/#plugins) resolves nested `cls_or_fn`/`params` definitions
# recursively, so we declare the whole agent tree — model, wrapper, the in-process `tools`, and the MCP `toolsets` —
# as a single config block. [`MCPToolset`](https://ai.pydantic.dev/mcp/client/) takes the path to a script and
# as a single config block. [`MCPToolset`](https://ai.pydantic.dev/api/mcp/#pydantic_ai.mcp.MCPToolset) takes the path to a script and

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

…I links

Replace the hardcoded ai.pydantic.dev API URLs with autoref cross-reference
syntax so the links resolve against pydantic-ai's published inventory instead
of rotting when upstream docs move. Addresses review feedback on #62.

MCPToolset and TestModel use the [full.path][] form (matching the house style
in config.md / authentication.py); RunContext keeps the short code-span form
since it is embedded in the RunContext[User] and RunContext.deps expressions.
@Adam-D-Lewis

Copy link
Copy Markdown
Member Author

Thanks @pmeier — done. All the hardcoded ai.pydantic.dev API links in the tutorial are now autoref Python refs that resolve through the inventories (pydantic_ai.mcp.MCPToolset, pydantic_ai.models.test.TestModel, etc.) instead of hand-written URLs.

One small deviation: I kept RunContext as a short code-span ref (display text RunContext, identifier pydantic_ai.tools.RunContext) rather than the full-path form, because it appears inside the RunContext[User] and RunContext.deps expressions, where the full dotted path rendered awkwardly. Happy to switch those to the full-path form too if you'd prefer consistency.

Verified locally with mkdocs build: all refs resolve and there are no cross-reference warnings. (Incidentally, the old hardcoded URLs were already 301-redirecting to pydantic.dev's new docs domain, so this clears that drift up too.)

@Adam-D-Lewis Adam-D-Lewis requested a review from pmeier June 26, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants