Skip to content

Conversation

RobJellinghaus
Copy link
Contributor

This change makes the tool macro's output safe for the missing_docs lint, by emitting a doc comment for the generated [tool]_tool_attr function. This doc comment is emitted regardless of whether the tool function is public, for simplicity.

Motivation and Context

We are building an MCP server using rmcp and discovered that the current crate was not compatible with the #![deny(missing_docs)] lint which we use everywhere.

How Has This Been Tested?

Tested by modifying the test_tool_macros.rs test to use #![deny(missing_docs)] and adding doc comments to all pub fns and structs in that file.

Breaking Changes

None.

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

Fixes #438

Checklist

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

@github-actions github-actions bot added T-test Testing related changes T-macros Macro changes labels Sep 14, 2025
@RobJellinghaus RobJellinghaus changed the title Add doc comment for generated tool attr fn fix(clippy): Add doc comment for generated tool attr fn Sep 14, 2025
@RobJellinghaus RobJellinghaus force-pushed the issue-438 branch 4 times, most recently from 8cb34bc to 8a7ae35 Compare September 14, 2025 17:55
This change makes the `tool` macro's output safe for the `missing_docs` lint, by
emitting a doc comment for the generated `[tool]_tool_attr` function. This doc
comment is emitted regardless of whether the tool function is public, for simplicity.

We are building an MCP server using `rmcp` and discovered that the current crate
was not compatible with the `#![deny(missing_docs)]` lint which we use everywhere.

Tested by modifying the `test_tool_macros.rs` test to use `#![deny(missing_docs)]`
and adding doc comments to all pub fns and structs in that file.

None.

Fixes modelcontextprotocol#438.
@RobJellinghaus RobJellinghaus changed the title fix(clippy): Add doc comment for generated tool attr fn fix(clippy): add doc comment for generated tool attr fn Sep 14, 2025
@4t145 4t145 merged commit ddef4ce into modelcontextprotocol:main Sep 17, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-macros Macro changes T-test Testing related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tool macro generates fn with missing docs
2 participants