Skip to content

feat: add message to ProgressNotification #435

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 13 commits into from
May 13, 2025

Conversation

aksheyd
Copy link
Contributor

@aksheyd aksheyd commented Apr 5, 2025

Added an optional message field to ProgressNotificationParams according to latest mcp spec.

Motivation and Context

Addressing #399 to add spec guidelines to sdk

How Has This Been Tested?

Added test_progress_notification to test messages bidirectionally. I'm hesitant that covers all angles so I'd like if someone could look over the test case a little more.

Breaking Changes

This did break test_176_progress_token, but it was over a schema check rather than implementation of the code (checking message=None since it's now an optional (default set to None) arg in fastmcp.server.report_progress().

Outside of test cases, no. Since the message field is optional, it shouldn't impact anything on release.

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

This is my first pull request to MCP (and honestly, to a codebase of this magnitude and quality). I’m incredibly excited to contribute, but also want to acknowledge that I might have missed some things. I’d really appreciate any extra scrutiny or tips reviewers can offer, especially around the test cases. Thanks in advance, and apologies if anything is off!

@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 adding the support for the message in Progress Notifications!

Some comments:

  • Having the message parameter on the progress() method (not the context manager) would be more intuitive

It would look like

async with progress(total=100) as p:
    await p.progress(10, message="Loading configuration...")
    await p.progress(30, message="Connecting to database...")
    await p.progress(40, message="Fetching data...")
    await p.progress(20, message="Processing results...")

would be great cover ProgressContext with tests as well

aksheyd and others added 6 commits May 7, 2025 13:04
Co-authored-by: ihrpr <inna.hrpr@gmail.com>
Co-authored-by: ihrpr <inna.hrpr@gmail.com>
Co-authored-by: ihrpr <inna.hrpr@gmail.com>
Co-authored-by: ihrpr <inna.hrpr@gmail.com>
@aksheyd
Copy link
Contributor Author

aksheyd commented May 7, 2025

Thank you!

Absolutely, that makes sense. I reviewed and committed your changes, and I'll add a test case for the ProgressContext as soon as possible. I also have the PR typecheck error fixed and can push that with the new test case.

@aksheyd
Copy link
Contributor Author

aksheyd commented May 8, 2025

Added a test case for the progress context manager.

Looks like the 3.11 check failed on test_188_concurrency.py by fractions of a second. It passed locally for me, so not sure how to best approach this. Would it make sense to trigger a re-run with a blank commit?

ihrpr
ihrpr previously approved these changes May 8, 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!

would be great to remove sleep in tests before merging

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 9e66f7c into modelcontextprotocol:main May 13, 2025
6 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