60e0ffc959
Upgrade checks / Notify on failure (push) Has been cancelled
Upgrade checks / Close issue on success (push) Has been cancelled
Schema Crash Test / Real-world schema crash test (232K schemas) (push) Has been cancelled
Run static analysis / static_analysis (push) Has been cancelled
Tests / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Tests / Tests with lowest-direct dependencies (push) Has been cancelled
Tests / MCP conformance tests (push) Has been cancelled
Tests / Integration tests (push) Has been cancelled
Tests / Package install smoke (push) Has been cancelled
Upgrade checks / Static analysis (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Upgrade checks / Integration tests (push) Has been cancelled
Update MCPServerConfig Schema / update-config-schema (push) Has been cancelled
Update SDK Documentation / update-sdk-docs (push) Has been cancelled
40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
---
|
|
title: docstring_parsing
|
|
sidebarTitle: docstring_parsing
|
|
---
|
|
|
|
# `fastmcp.utilities.docstring_parsing`
|
|
|
|
|
|
Extract descriptions from function docstrings.
|
|
|
|
Uses griffelib to parse Google, NumPy, and Sphinx-style docstrings. The
|
|
interface is intentionally narrow — a single function returning a
|
|
`ParsedDocstring` — so the implementation can be swapped without touching
|
|
callers.
|
|
|
|
|
|
## Functions
|
|
|
|
### `parse_docstring` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/utilities/docstring_parsing.py#L35" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
parse_docstring(fn: Callable[..., Any]) -> ParsedDocstring
|
|
```
|
|
|
|
|
|
Parse a function's docstring into a summary and parameter descriptions.
|
|
|
|
Tries Google, NumPy, and Sphinx parsers in order, using the first one that
|
|
successfully extracts parameter descriptions. If none do, returns the full
|
|
docstring as the description with no parameter descriptions.
|
|
|
|
|
|
## Classes
|
|
|
|
### `ParsedDocstring` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/utilities/docstring_parsing.py#L28" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
|
|
The extracted description and per-parameter descriptions from a docstring.
|
|
|