Skip to content

Conversation

@meAmitPatil
Copy link

Replace custom tool implementations with AI SDK tools to reduce code duplication. Addresses issue #40 by consolidating all MCP tool logic into the AI SDK.

  • Use createWriteActionTool, createCheckConnectionTool, createCreateInstallationTool, createCheckInstallationTool, createStartOAuthTool, and createSendRequestTool from @amp-labs/ai/mcp
  • Remove duplicate tool implementations (connection.ts, oauth.ts, request.ts, write.ts)
  • Add createSendReadRequestTool for backward compatibility
  • Maintain same API surface for existing MCP clients

Replace custom tool implementations with AI SDK tools to reduce code duplication.
Addresses issue amp-labs#40 by consolidating all MCP tool logic into the AI SDK.

- Use createWriteActionTool, createCheckConnectionTool, createCreateInstallationTool, createCheckInstallationTool, createStartOAuthTool, and createSendRequestTool from @amp-labs/ai/mcp
- Remove duplicate tool implementations (connection.ts, oauth.ts, request.ts, write.ts)
- Add createSendReadRequestTool for backward compatibility
- Maintain same API surface for existing MCP clients
Copilot AI review requested due to automatic review settings June 27, 2025 05:54
Copy link

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 MCP server to consolidate all custom tool implementations into the shared AI SDK, removes duplicate code, and adds a backward-compatible send-read-request tool.

  • Removed standalone tool implementations in write.ts, request.ts, oauth.ts, and connection.ts
  • Imported and wired up SDK-provided tools (createWriteActionTool, createCheckConnectionTool, createCreateInstallationTool, createCheckInstallationTool, createStartOAuthTool, createSendRequestTool)
  • Added an inline createSendReadRequestTool in index.ts for backward compatibility

Reviewed Changes

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

Show a summary per file
File Description
mcp-server/src/write.ts Removed custom create/update write tools, now using SDK’s createWriteActionTool.
mcp-server/src/request.ts Deleted custom send-request and send-read-request tools in favor of SDK’s createSendRequestTool.
mcp-server/src/oauth.ts Deleted custom OAuth flow tool, now using SDK’s createStartOAuthTool.
mcp-server/src/index.ts Updated imports to pull tools from the AI SDK, inlined backward compatibility send-read-request tool, and updated tool registration order.
mcp-server/src/connection.ts Removed custom connection and installation tools, replaced by SDK’s createCheckConnectionTool, createCreateInstallationTool, and createCheckInstallationTool.
Comments suppressed due to low confidence (1)

mcp-server/src/index.ts:34

  • Since createSendReadRequestTool was added for backward compatibility, ensure you have unit or integration tests covering both successful GET requests and error scenarios for this tool.
async function createSendReadRequestTool(


export type ClientSettings = typeof clientSettings;

async function createSendReadRequestTool(
Copy link

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

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

The createSendReadRequestTool implementation in index.ts duplicates logic that could be centralized; consider extracting it into its own module or upgrading the AI SDK with a first-class createSendReadRequestTool export to avoid local duplication.

Copilot uses AI. Check for mistakes.
},
],
};
} catch (error) {
Copy link

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

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

The catch block for send-read-request currently suppresses errors without logging; add a console.error (or use the project's logging utility) here to aid in debugging failed requests.

Suggested change
} catch (error) {
} catch (error) {
console.error('Error occurred in send-read-request tool:', error);

Copilot uses AI. Check for mistakes.
@laurenzlong laurenzlong requested a review from caiopizzol August 15, 2025 03:43
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