fix: correct mock MCP tool names to match real M365 server contracts#301
Merged
sellakumaran merged 2 commits intomicrosoft:mainfrom Mar 6, 2026
Merged
Conversation
All four mock tool definition files had drifted from the tool catalogs exposed by real M365 MCP servers, causing agents developed against the mocks to encounter tool-not-found errors when switched to real servers. Mock corrections: - CalendarTools: rename 9 tools camelCase->PascalCase, remove 3 phantom tools (getEvent, getOrganization, getSchedule), add 4 missing tools (TentativelyAcceptEvent, ForwardEvent, GetUserDateAndTimeZoneSettings, GetRooms) - MailTools: strip Async suffix from all 20 tool names, add FlagEmail - MeServer: rename all 5 tools to match real server names - KnowledgeTools: replace 3 disabled placeholders with 5 real tools Fidelity infrastructure to prevent future drift: - snapshots/*.snapshot.json: authoritative tool catalogs captured from live M365 MCP servers (contract layer) - MockToolFidelityTests: CI gate asserting bidirectional coverage between mocks and snapshots (no credentials needed) - MockToolSnapshotCaptureTests: developer tool for drift detection and snapshot refresh (requires MCP_BEARER_TOKEN env var) Fixes microsoft#300 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Mock Tooling Server’s MCP mock catalogs to better align with the live M365 MCP tool catalogs, and adds snapshot-driven tests intended to prevent future drift.
Changes:
- Added snapshot capture + fidelity test suites for mock-vs-live tool catalog alignment.
- Added checked-in snapshot JSON catalogs for four MCP servers.
- Updated mock JSON tool definitions and Mock Tooling Server documentation to reflect the new contract approach.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/MockTools/MockToolSnapshotCaptureTests.cs | New developer-run integration tests to query live MCP servers and refresh/verify snapshots. |
| src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/MockTools/MockToolFidelityTests.cs | New CI-facing tests to check mock/snapshot coverage. |
| src/Microsoft.Agents.A365.DevTools.MockToolingServer/snapshots/*.snapshot.json | New authoritative tool catalogs captured from live servers (4 files). |
| src/Microsoft.Agents.A365.DevTools.MockToolingServer/snapshots/README.md | New documentation describing snapshot schema and update flow. |
| src/Microsoft.Agents.A365.DevTools.MockToolingServer/mocks/mcp_CalendarTools.json | Renamed/adjusted CalendarTools tool entries. |
| src/Microsoft.Agents.A365.DevTools.MockToolingServer/mocks/mcp_MailTools.json | Renamed MailTools tool entries and added FlagEmail. |
| src/Microsoft.Agents.A365.DevTools.MockToolingServer/mocks/mcp_MeServer.json | Renamed MeServer tools to match live names. |
| src/Microsoft.Agents.A365.DevTools.MockToolingServer/mocks/mcp_KnowledgeTools.json | Replaced placeholder tools with live server snake_case tools. |
| src/Microsoft.Agents.A365.DevTools.MockToolingServer/README.md | Updated server/tool documentation and described the fidelity contract. |
| src/Microsoft.Agents.A365.DevTools.MockToolingServer/design.md | Updated design doc/diagram to include snapshots + fidelity testing. |
Comments suppressed due to low confidence (2)
src/Microsoft.Agents.A365.DevTools.MockToolingServer/mocks/mcp_MailTools.json:489
- The mock
SearchMessagestool schema/description still reflects a KQL-based Graph search (queryString, optional fields), but the real-server snapshot defines a natural-languagemessagefield that is required (plusconversationId). To prevent schema-mismatch when switching from mock to real servers, update the mock’sinputSchema/description to match the snapshot contract.
"name": "SearchMessages",
"description": "Search Outlook messages using Microsoft Graph Search API with KQL-style queries.",
"inputSchema": {
"type": "object",
"properties": {
"queryString": {
"type": "string",
"description": "KQL-style search string (e.g., 'contoso OR from:user@example.com')"
},
src/Microsoft.Agents.A365.DevTools.MockToolingServer/mocks/mcp_MeServer.json:72
- The mock
GetUserDetailstool usesuserIdas the required parameter, but the snapshot contract formcp_MeServerrequiresuserIdentifier(name/email/id) and includes additional optional fields (select,expand). This mismatch can cause agents built against the mock to send the wrong argument name to the real server. Update the mockinputSchemato match the snapshot.
"name": "GetUserDetails",
"description": "Get the profile of a specific user by their ID or userPrincipalName.",
"inputSchema": {
"type": "object",
"properties": {
"userId": {
"type": "string",
"description": "The unique identifier (GUID) or userPrincipalName (email) of the user to retrieve."
},
"select": {
"type": "string",
"description": "Comma-separated list of properties to return."
}
},
"required": ["userId"]
},
src/Microsoft.Agents.A365.DevTools.MockToolingServer/mocks/mcp_CalendarTools.json
Outdated
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.MockToolingServer/mocks/mcp_CalendarTools.json
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.MockToolingServer/snapshots/README.md
Show resolved
Hide resolved
src/Microsoft.Agents.A365.DevTools.MockToolingServer/mocks/mcp_CalendarTools.json
Show resolved
Hide resolved
src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/MockTools/MockToolSnapshotCaptureTests.cs
Outdated
Show resolved
Hide resolved
src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/MockTools/MockToolSnapshotCaptureTests.cs
Outdated
Show resolved
Hide resolved
src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/MockTools/MockToolFidelityTests.cs
Outdated
Show resolved
Hide resolved
sellakumaran
previously approved these changes
Mar 5, 2026
…ot refresh - Extend MockToolFidelityTests to validate inputSchema required fields and property names (not just tool names) against snapshots — CI-enforced - Add MergeMockFile to MockToolSnapshotCaptureTests so MCP_UPDATE_SNAPSHOTS=true refreshes both snapshot and mock files in one step; preserves existing responseTemplate/delayMs/errorRate for unchanged tools, adds new tools with defaults, marks removed tools as enabled=false for review - Fix pre-existing mock schema drift detected by the new fidelity tests: CalendarTools: CreateEvent, UpdateEvent, DeleteEventById, FindMeetingTimes, AcceptEvent, DeclineEvent, CancelEvent (remove OData-style userId path param, replace flat scalar fields for start/end/attendees) MailTools: GetMessage (add bodyPreviewOnly property) MeServer: GetMyDetails (add expand), GetMultipleUsersDetails (replace search/ filter with searchValues array, add required), GetManagerDetails (add select, fix required), GetDirectReportsDetails (replace top with select, fix required) - Update README files to document auto-merge workflow and inputSchema enforcement Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sellakumaran
approved these changes
Mar 6, 2026
gwharris7
approved these changes
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #300 — All four mock tool definition files had drifted from the tool catalogs exposed by real M365 MCP servers. Agents developed against the mocks would encounter tool-not-found errors when switched to real servers. There was no mechanism to detect or prevent this drift.
This PR:
Changes
Mock file corrections
createEvent→CreateEvent,deleteEvent→DeleteEventById). Removed 3 phantom tools not on real server (getEvent,getOrganization,getSchedule). Added 4 missing tools (TentativelyAcceptEvent,ForwardEvent,GetUserDateAndTimeZoneSettings,GetRooms).Asyncsuffix from all 20 tool names (e.g.SendEmailWithAttachmentsAsync→SendEmailWithAttachments). Added missingFlagEmailtool.getMyProfile→GetMyDetails,listUsers→GetMultipleUsersDetails).Fidelity infrastructure (new)
snapshots/*.snapshot.json(4 files)MockToolFidelityTests.csMockToolSnapshotCaptureTests.csMCP_BEARER_TOKENenv var (skips gracefully when absent).snapshots/README.mdDocumentation updates
MockToolingServer/README.md— Updated server table with correct tool names, added Fidelity Contract and Keeping Mocks Current sectionsMockToolingServer/design.md— Added fidelity architecture to flowchart and design descriptionHow the fidelity contract works
MCP_BEARER_TOKEN. Detects drift or writes updated snapshots:Test plan
MockToolFidelityTests— 8/8 passing (4 servers x 2 directions)MockToolSnapshotCaptureTests— 4/4 passing (skip gracefully with no token)🤖 Generated with Claude Code