Skip to content
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

Fix sampling fn type error clean #367

Closed

Conversation

microsoftmj
Copy link

This PR fixes the SamplingFnT type error in the MCP client session. It replaces PR #366 with a cleaner implementation.

Changes:

  • Modified MCPSamplingMessageHandler type to use a more flexible approach with ellipsis (...) syntax for parameters
  • Updated the dynamic URL documentation with SamplingFnT error reference
  • Added comprehensive documentation in SAMPLING_FN_TYPE_ERROR_FIX.md
  • Added --isolated flag to UV commands to prevent locking conflicts in CI environment

Note:
This PR has been split from the original one to focus only on the core fix, excluding the package management changes that will be proposed separately after discussion.

This commit adds the ability to dynamically pull the VSCode MCP server URL from the VSCode output for the semantic workbench. It includes:

1. Modifications to the VSCode MCP server extension to store the URL in a global variable
2. Utility functions in the semantic workbench to access and update the dynamic URL
3. A script to update assistant configuration files with the current URL
4. Documentation for the new feature

The feature ensures that the semantic workbench always uses the correct VSCode MCP server URL, even if the port changes.
This commit fixes a critical type error in the MCP client session related to the SamplingFnT class. The issue was that the SamplingFnT class in the mcp.client.session module was using RequestContext with two type parameters, but the installed version of RequestContext only accepted one type parameter.

Key changes:
1. Modified the MCPSamplingMessageHandler type to use a more flexible approach with the ellipsis (...) syntax for parameters
2. Updated related files to use this new approach
3. Removed explicit type annotations in handler methods

This fix ensures that the VSCode MCP server dynamic URL feature works correctly without type errors, allowing the semantic workbench to properly connect to the VSCode MCP server.
… fix

This commit adds detailed documentation explaining the SamplingFnT type error issue and its resolution. The documentation includes:

1. A clear explanation of the original error and its root cause
2. Detailed description of the changes made to fix the issue
3. Code examples showing the before and after states
4. Testing procedures used to verify the fix
5. Impact analysis of the fix on the VSCode MCP server dynamic URL feature

This documentation will help developers understand the issue if they encounter similar problems in the future, and provides a reference for the technical details of the fix.
…rror reference

This commit enhances the VSCode MCP server dynamic URL documentation by adding a reference to the SamplingFnT type error fix in the troubleshooting section. The update includes:

1. A new troubleshooting entry specifically for the SamplingFnT type error
2. A direct link to the detailed documentation (SAMPLING_FN_TYPE_ERROR_FIX.md)
3. Integration with the existing troubleshooting workflow

This update ensures that users who encounter the SamplingFnT type error while using the VSCode MCP server dynamic URL feature can quickly find the solution and understand the technical details of the fix.
This change addresses an issue where multiple parallel CI processes attempt to
access the same lock files simultaneously, causing builds to fail intermittently.
The --isolated flag ensures each process operates independently without
sharing lock files, thereby eliminating race conditions in the CI environment.

Changes:
- Added --isolated flag to UV_SYNC_INSTALL_ARGS
- Added --isolated flag to UV_RUN_ARGS
- Added --isolated flag to the lock target

Impact:
- More reliable CI builds
- No functional changes to the build output
- Compatible with both local development and CI environments
@microsoftmj microsoftmj force-pushed the fix-sampling-fn-type-error-clean branch from 60ffbff to 76032fa Compare March 3, 2025 21:06
@microsoftmj microsoftmj closed this Mar 3, 2025
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.

1 participant