Skip to content

Conversation

@aaronburtle
Copy link
Contributor

Why make this change?

Closes #2919

What is this change?

Refactors the Read and Update built in MCP tools so that they use the common BuildErrorResult and BuildSuccessResult functiosn in the Utils, aligning their usage with the other tools.

How was this tested?

Run against normal test suite.

Sample Request(s)

N/A

@aaronburtle
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

Copilot finished reviewing on behalf of aaronburtle November 18, 2025 22:25
Copy link
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 refactors the ReadRecordsTool and UpdateRecordTool to use centralized utility functions from McpResponseBuilder, improving code consistency and maintainability across all MCP tools.

  • Replaces local BuildErrorResult, BuildSuccessResult, and ExtractResultJson methods with calls to McpResponseBuilder utilities
  • Enhances response format to include entity and message fields, aligning with other MCP tools
  • Moves result filtering logic inline in UpdateRecordTool before passing to the utility function

Reviewed Changes

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

File Description
src/Azure.DataApiBuilder.Mcp/BuiltInTools/ReadRecordsTool.cs Refactored to use McpResponseBuilder utilities; removed duplicate helper methods; improved exception handling to capture exception details
src/Azure.DataApiBuilder.Mcp/BuiltInTools/UpdateRecordTool.cs Refactored to use McpResponseBuilder utilities; moved result filtering logic inline; removed duplicate helper methods while preserving GetJsonValue utility

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

Copy link
Collaborator

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

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

Need to ensure we log the kind of tool it is in BuildErrorResult

Copy link
Collaborator

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

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

Since there are no automated tests yet, have you tested the refactoring did not introduce any regressions using Mcp Inspector?

@aaronburtle
Copy link
Contributor Author

Since there are no automated tests yet, have you tested the refactoring did not introduce any regressions using Mcp Inspector?

Still need to test with the inspector, will add the test results to the PR description when done.

@aaronburtle
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align successful response for built-in mcp tools to all use the mcp utility function

4 participants