Skip to content

Conversation

Copy link

Copilot AI commented Sep 8, 2025

This PR implements an Intelligent Agent to Agent (IA2A) service interface that extends the existing A2A server with Model Context Protocol (MCP) compatible tools, enabling seamless integration with VS Code and GitHub Copilot.

Overview

The implementation adds two new MCP tools to the A2A server:

  • PromptGemini: Send arbitrary prompts to Gemini and receive responses
  • ReviewGemini: Perform specialized code reviews with configurable review types (security, performance, general)

Key Features

HTTP API Endpoints

  • GET /mcp/tools - Discover available MCP tools with their schemas
  • POST /mcp/tools/{toolName}/execute - Execute specific tools with parameters

Tool Capabilities

  • PromptGemini: Accepts prompt (required) and context (optional) parameters
  • ReviewGemini: Accepts code (required), language (optional), and reviewType (optional) parameters
  • Both tools integrate with the Gemini CLI using gemini -p commands
  • Configurable timeouts (30s for prompts, 60s for reviews)
  • Comprehensive error handling and parameter validation

Architecture

VS Code/GitHub Copilot → HTTP API → MCP Tools → Gemini CLI → Gemini AI

Implementation Details

The solution extends the existing A2A server without breaking changes by:

  1. Adding new MCP tool implementations in src/mcp/tools/
  2. Creating HTTP routes in src/http/mcp-routes.ts
  3. Integrating routes into the main app without affecting existing functionality
  4. Following existing patterns for logging, error handling, and testing

Testing

  • 14 unit tests covering all tool functionality (100% pass rate)
  • 6 integration tests validating HTTP API endpoints
  • Test-driven development approach used throughout
  • Full TypeScript compilation with strict type checking

Usage Examples

Tool Discovery

curl http://localhost:41242/mcp/tools

Execute PromptGemini

curl -X POST http://localhost:41242/mcp/tools/PromptGemini/execute \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Explain TypeScript generics"}'

Execute ReviewGemini

curl -X POST http://localhost:41242/mcp/tools/ReviewGemini/execute \
  -H "Content-Type: application/json" \
  -d '{
    "code": "function hello() { console.log(\"Hello\"); }",
    "language": "javascript", 
    "reviewType": "security"
  }'

Files Added/Modified

  • New: src/mcp/tools/ directory with tool implementations and tests
  • New: src/http/mcp-routes.ts for HTTP API endpoints
  • Modified: src/http/app.ts to integrate MCP routes
  • New: Comprehensive documentation and task specification

This implementation provides a foundation for agent-to-agent communication through the existing A2A server infrastructure while maintaining compatibility and following established patterns.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • play.googleapis.com
  • test.proxy.com
    • Triggering command: node (vitest 3) (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Created from VS Code via the GitHub Pull Request extension.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: mrlarson2007 <26290727+mrlarson2007@users.noreply.github.com>
Copilot AI changed the title [WIP] Please follow the task in #file:TASK_IA2ASERVICE_INTERFACE.md and implement the requested feature using TDD Implement IA2A Service Interface with MCP Tools for Gemini CLI Integration Sep 8, 2025
Copilot AI requested a review from mrlarson2007 September 8, 2025 22:33
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.

2 participants