Skip to content

[MCP] Make storage observer resilient to duplicates and bad documents#9673

Merged
glen-84 merged 7 commits into
mainfrom
gai/fix-mcp-duplicate-features
May 12, 2026
Merged

[MCP] Make storage observer resilient to duplicates and bad documents#9673
glen-84 merged 7 commits into
mainfrom
gai/fix-mcp-duplicate-features

Conversation

@glen-84
Copy link
Copy Markdown
Member

@glen-84 glen-84 commented May 11, 2026

No description provided.

Copilot AI review requested due to automatic review settings May 11, 2026 13:58
Copy link
Copy Markdown
Contributor

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 PR updates the MCP adapter’s storage observer initialization to tolerate duplicate prompt/tool names (instead of throwing on duplicate dictionary keys), and adds integration tests to ensure listing prompts/tools no longer crashes when duplicates exist.

Changes:

  • Deduplicate prompt definitions by name during McpStorageObserver initialization.
  • Deduplicate tool definitions by name during McpStorageObserver initialization.
  • Add a test-only IMcpStorage implementation that can return duplicate definitions, plus new integration tests covering the duplicate-name scenarios.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/HotChocolate/Adapters/src/Adapters.Mcp.Core/McpStorageObserver.cs Deduplicates prompt/tool definitions during initial load to avoid crashing on duplicate names.
src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/MultiCollectionMcpStorage.cs Adds a test IMcpStorage implementation that returns definitions verbatim (including duplicates).
src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/IntegrationTestBase.cs Adds integration tests asserting duplicates are deduped and list operations don’t crash.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/HotChocolate/Adapters/src/Adapters.Mcp.Core/McpStorageObserver.cs Outdated
Comment thread src/HotChocolate/Adapters/src/Adapters.Mcp.Core/McpStorageObserver.cs Outdated
@glen-84 glen-84 changed the title [MCP] Deduplicate tool and prompt names on load [MCP] Make storage observer resilient to duplicates and bad documents May 12, 2026
@glen-84 glen-84 requested a review from Copilot May 12, 2026 08:50
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • src/HotChocolate/Adapters/src/Adapters.Mcp.Abstractions/Properties/McpAdapterResources.Designer.cs: Language not supported

Comment thread src/HotChocolate/Adapters/src/Adapters.Mcp.Core/McpStorageObserver.cs Outdated
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • src/HotChocolate/Adapters/src/Adapters.Mcp.Abstractions/Properties/McpAdapterResources.Designer.cs: Language not supported

Comment thread src/HotChocolate/Adapters/src/Adapters.Mcp.Core/McpStorageObserver.cs Outdated
Comment thread src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/IntegrationTestBase.cs Outdated
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • src/HotChocolate/Adapters/src/Adapters.Mcp.Abstractions/Properties/McpAdapterResources.Designer.cs: Language not supported

Comment thread src/HotChocolate/Adapters/src/Adapters.Mcp.Core/McpStorageObserver.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants