Skip to content

Conversation

@leehack
Copy link
Owner

@leehack leehack commented Aug 7, 2025

Close #35

This pull request refactors how tool schemas are defined and registered across several example servers and the core MCP server implementation. The main change is the transition from using raw schema property maps to dedicated ToolInputSchema and ToolOutputSchema objects, improving type safety and clarity. Backwards compatibility is maintained for the old properties with deprecation notices.

Core API and Schema Registration Changes

  • The McpServer.tool method now accepts toolInputSchema and toolOutputSchema parameters instead of (or in addition to, for backwards compatibility) the previous inputSchemaProperties and outputSchemaProperties maps. The old parameters are marked as deprecated. (lib/src/server/mcp.dart)
  • The _RegisteredTool class and related logic have been updated to store and use ToolInputSchema and ToolOutputSchema instead of raw property maps. (lib/src/server/mcp.dart) [1] [2] [3]

Example Server Updates

  • All example servers (server_stdio.dart, server_sse.dart, server_streamable_https.dart, weather.dart, server_iostream.dart) have been updated to use the new toolInputSchema parameter, replacing inputSchemaProperties. Where appropriate, required fields are now explicitly listed. [1] [2] [3] [4] [5] [6] [7] [8] [9]

These changes modernize the schema registration approach, making it more robust and maintainable while preserving compatibility with existing code.

@leehack leehack requested a review from Copilot August 7, 2025 00:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request modernizes tool schema registration by transitioning from raw property maps to dedicated ToolInputSchema and ToolOutputSchema objects, improving type safety and clarity while maintaining backwards compatibility. The core change introduces new schema parameters with deprecation warnings for the old approach.

  • Updated McpServer.tool method to accept toolInputSchema and toolOutputSchema parameters
  • Refactored _RegisteredTool class to use schema objects instead of property maps
  • Added explicit required field specifications across all example servers

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lib/src/server/mcp.dart Core API changes with new schema parameters and backwards compatibility
example/weather.dart Updated weather tools to use new schema format with required fields
example/streamable_https/server_streamable_https.dart Converted greeting and notification tools to new schema format
example/server_stdio.dart Updated calculator tool with new schema and required fields
example/server_sse.dart Converted calculator tool to use new schema format
example/iostream-client-server/server_iostream.dart Updated calculator tool with new schema structure

@codecov
Copy link

codecov bot commented Aug 7, 2025

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.54%. Comparing base (1f08bd5) to head (5015f7d).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
lib/src/server/mcp.dart 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #36      +/-   ##
==========================================
- Coverage   45.55%   45.54%   -0.01%     
==========================================
  Files          15       15              
  Lines        2880     2874       -6     
==========================================
- Hits         1312     1309       -3     
+ Misses       1568     1565       -3     
Flag Coverage Δ
unittests 45.54% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leehack leehack merged commit 289fd9a into main Aug 7, 2025
4 of 5 checks passed
@leehack leehack deleted the add-required-field branch August 7, 2025 00:49
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.

Required properties

2 participants