Skip to content

fix: Update @mcp.resource to use function documentation as default descrip… #489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 15, 2025

Conversation

jingyugao
Copy link
Contributor

@jingyugao jingyugao commented Apr 11, 2025

mcp.resource doesn't generate correctly description from func.doc.
see #488

Motivation and Context

generate correctly description from func.doc when param description is none.

How Has This Been Tested?

Yes

Breaking Changes

No

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

@jingyugao jingyugao changed the title Update @mcp.resource to use function documentation as default descrip… fix: Update @mcp.resource to use function documentation as default descrip… Apr 11, 2025
@ihrpr ihrpr added this to the r-05-25 milestone Apr 29, 2025
Copy link
Contributor

@ihrpr ihrpr left a comment

Choose a reason for hiding this comment

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

Thank you for working on this.

I think it would better suited to add from_funciton method as we have in Tool and Templave and there do things like func_doc = description or fn.__doc__ or ""

Please can you also add tests? #501 had some tests related to this.

@jingyugao jingyugao force-pushed the main branch 2 times, most recently from 1e4a286 to 1140d1f Compare May 4, 2025 03:06
@jingyugao
Copy link
Contributor Author

Thank you for working on this.

I think it would better suited to add from_funciton method as we have in Tool and Templave and there do things like func_doc = description or fn.__doc__ or ""

Please can you also add tests? #501 had some tests related to this.

Thanks for your comment. I add from_funciton into FcuntionResourse class.

Copy link
Contributor

@ihrpr ihrpr left a comment

Choose a reason for hiding this comment

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

thank you, a few changes and good to merge:

  • return type
  • func_name should be used in name
  • update docstring

description: str | None = None,
mime_type: str | None = None,
):
"""Create a template from a function."""
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be updated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

@ihrpr ihrpr left a comment

Choose a reason for hiding this comment

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

thank you!

@ihrpr ihrpr merged commit 1bdeed3 into modelcontextprotocol:main May 15, 2025
10 checks passed
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