Skip to content

feat: extract parameter descriptions from docstrings into JSON schema#2390

Open
Thibbeer wants to merge 1 commit intomodelcontextprotocol:mainfrom
Thibbeer:feat/docstring-param-descriptions
Open

feat: extract parameter descriptions from docstrings into JSON schema#2390
Thibbeer wants to merge 1 commit intomodelcontextprotocol:mainfrom
Thibbeer:feat/docstring-param-descriptions

Conversation

@Thibbeer
Copy link
Copy Markdown

@Thibbeer Thibbeer commented Apr 3, 2026

Parses Google, NumPy, and Sphinx docstring styles with auto-detection. Injects descriptions into the Pydantic Field used for JSON schema generation, so tools get richer metadata for LLM consumption.

Explicit Field(description=...) annotations always take precedence.

Closes #226

Motivation and Context

How Has This Been Tested?

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Copy link
Copy Markdown
Author

@Thibbeer Thibbeer left a comment

Choose a reason for hiding this comment

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

Before: {"properties": {"city": {"type": "string"}}}
After: {"properties": {"city": {"type": "string", "description": "The city name to look up."}}}

@Thibbeer Thibbeer force-pushed the feat/docstring-param-descriptions branch 3 times, most recently from 25d12a4 to 9b99474 Compare April 3, 2026 21:54
Parses Google, NumPy, and Sphinx docstring styles with auto-detection.
Injects descriptions into the Pydantic Field used for JSON schema
generation, so tools get richer metadata for LLM consumption.

Explicit Field(description=...) annotations always take precedence.

Closes modelcontextprotocol#226
@Thibbeer Thibbeer force-pushed the feat/docstring-param-descriptions branch from 9b99474 to f0946ae Compare April 3, 2026 21:56
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.

Improving how function docstring gets converted to tool's jsonschema for FastMCP

1 participant