Skip to content

Conversation

@aaronburtle
Copy link
Contributor

@aaronburtle aaronburtle commented Nov 18, 2025

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?

Manually tested using MCP Inspector tool, and run against normal test suite.

  • DESCRIBE_ENTITIES
image
  • CREATE
image
  • READ
image
  • UPDATE
image
  • DELETE
image

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).

@aaronburtle aaronburtle added this to the Nov 2025 milestone Nov 25, 2025
@github-project-automation github-project-automation bot moved this from Todo to Review In Progress in Data API builder Nov 25, 2025
Copy link
Contributor

@souvikghosh04 souvikghosh04 left a comment

Choose a reason for hiding this comment

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

Thanks for the changes. Please address the pending comments.

Copy link
Contributor

@anushakolan anushakolan left a comment

Choose a reason for hiding this comment

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

LGTM.

@aaronburtle
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@aaronburtle aaronburtle dismissed Aniruddh25’s stale review November 26, 2025 05:21

stale, testing added.

@aaronburtle aaronburtle merged commit dd72498 into main Nov 26, 2025
11 checks passed
@aaronburtle aaronburtle deleted the dev/aaronburtle/RefactorCommonMCPResponse branch November 26, 2025 05:27
@github-project-automation github-project-automation bot moved this from Review In Progress to Done in Data API builder Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

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

6 participants