Tutorial¶
Working usage examples¶
Render one tool card:
```{eval-rst}
.. fastmcp-tool:: my_project.docs.fastmcp_tools.list_sessions
```
Render one tool’s parameter table:
```{eval-rst}
.. fastmcp-tool-input:: my_project.docs.fastmcp_tools.list_sessions
```
Render a summary table grouped by safety tier:
```{eval-rst}
.. fastmcp-tool-summary::
```
Add inline cross-references in prose:
Use {tool}`list_sessions` for a linked badge, or {toolref}`delete_session`
for a plain inline reference.
Prompts and resources¶
After setting fastmcp_server_module, four MyST directives become available
for documenting MCP prompts and resources:
```{fastmcp-prompt} my_prompt
```
```{fastmcp-prompt-input} my_prompt
```
```{fastmcp-resource} my_resource
```
```{fastmcp-resource-template} my_resource_template
```
Resources and resource templates accept either the friendly component name
(my_resource) or the literal URI (mem://my_resource). When two
distinct resources share a name, autodoc keeps the first registration and
emits a warning — disambiguate by URI.
:ref: cross-reference IDs¶
Section IDs follow fastmcp-{kind}-{name} (canonical):
{ref}`fastmcp-tool-list-sessions`
{ref}`fastmcp-prompt-greet`
{ref}`fastmcp-resource-status`
{ref}`fastmcp-resource-template-events-by-day`
Tool sections additionally register the bare slug as a back-compat alias
(e.g. {ref}list-sessions`` continues to resolve), preserving links
shipped before the kind-prefix introduction. Prompts, resources, and
resource templates use the canonical ID only — no bare alias is created
for them.