Something went wrong. Try again.
mirror of github.com/PrefectHQ/fastmcp
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142---title: docstring_parsingsidebarTitle: docstring_parsing---
# `fastmcp.utilities.docstring_parsing`
Extract descriptions from function docstrings.
Uses griffelib to parse Google, NumPy, and Sphinx-style docstrings. Theinterface is intentionally narrow — a single function returning a`ParsedDocstring` — so the implementation can be swapped without touchingcallers.
## Functions
### `parse_docstring` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/utilities/docstring_parsing.py#L33" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
```pythonparse_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 thatrecognizes a structured section (parameters, returns, raises, and so on).The description is the free-form text before the first such section. If noparser recognizes a section, returns the full docstring as the descriptionwith no parameter descriptions.
## Classes
### `ParsedDocstring` <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/fastmcp_slim/fastmcp/utilities/docstring_parsing.py#L26" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
The extracted description and per-parameter descriptions from a docstring.