Skip to content

Conversation

@nmaguiar
Copy link
Collaborator

This pull request introduces several improvements and new features related to agent handling in the MCP client and enhances the Gemini AI integration. The most significant changes are the addition of agent management functions to $mcp, improved handling of Gemini API responses and prompts, and some code quality improvements.

MCP Agent Management Enhancements

  • Added agent management stubs to $mcp, including JSON-RPC endpoints for listing, retrieving, and sending messages to agents (agents/list, agents/get, agents/send). These stubs support basic agent metadata and message handling, including error responses and handler functions.
  • Introduced new $mcp client methods: listAgents, getAgent, and sendToAgent, each with documentation and error handling to interact with A2A agents via MCP. These methods require initialization and support hooks for pre/post-processing.

Gemini AI Integration Improvements

  • Enhanced Gemini stats extraction: now includes modelVersion, responseId, and additional token usage fields (cachedContentTokenCount, thoughtsTokenCount) in the stats map for better tracking and reporting.
  • Improved prompt and system instruction handling: system instructions are now more robustly extracted from the conversation, filtering out undefined values and supporting both parts and content fields.
  • Improved function call response handling: parses stringified JSON results and standardizes output format for Gemini tool calls, ensuring results are returned as objects, arrays, or wrapped in a consistent structure.
  • Ensured that only defined prompts are added to the conversation history, preventing undefined values from causing issues in AI interactions.

Code Quality Improvements

  • Filtered out undefined results from Gemini tool calls to ensure clean output arrays.
  • Fixed tool call chaining to always pass an empty tools list to subsequent raw prompts, avoiding accidental reuse of tools.

Removal of Legacy Shell Completion Scripts

  • Removed obsolete shell completion scripts for openaf and opack, cleaning up unused code from the repository. (complete/completion_oaf.sh, complete/completion_opack.sh)

- Updated AFCmdBase, AFCmdOS, CSV, SimpleLog, and various plugins to use Function instead of NativeFunction for better compatibility with the latest Rhino JavaScript engine.
- Adjusted method signatures in HTTP, HTTPServer, JMXServer, SNMPServer, and Threads to reflect the change in function type.
- Ensured consistent usage of Function across all relevant classes to streamline the codebase and improve maintainability.
…, and enhance OAFdCL classloader cache pre-warming
This reverts commit 2bff4d6, reversing
changes made to bd77881.
@nmaguiar nmaguiar requested a review from Copilot January 14, 2026 03:36
@nmaguiar nmaguiar self-assigned this Jan 14, 2026
@nmaguiar nmaguiar added the bug label Jan 14, 2026
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 pull request introduces Agent-to-Agent (A2A) messaging capabilities over MCP (Model Context Protocol), enhances Gemini AI integration with improved stats tracking and function call handling, and performs maintenance tasks including dependency updates and removal of obsolete shell completion scripts.

Changes:

  • Added A2A agent registry and messaging infrastructure with MCP integration, including agent management endpoints and client methods
  • Enhanced Gemini AI integration with improved token stats tracking, system instruction handling, and function call response normalization
  • Updated multiple Java and JavaScript dependencies and removed legacy shell completion scripts

Reviewed changes

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

Show a summary per file
File Description
js/owrap.server.js Adds A2A registry class with agent management, rate limiting, authentication, and MCP protocol integration
js/openaf.js Implements $mcp client methods for A2A agent interactions (listAgents, getAgent, sendToAgent)
js/owrap.ai.js Enhances Gemini stats extraction, improves function call response handling, adds ow.ai.agent helper, and refactors decision tree predicates
src/openaf/AFCmdBase.java Updates version, replaces NativeFunction with Function interface, adds static block for logging config, and simplifies SimpleLog initialization
tests/autoTestAll.A2A.yaml Adds comprehensive test suite for A2A functionality
tests/autoTestAll.A2A.js Implements test functions for A2A registry, server, client, messaging, auth, size limits, and rate limits
pom.json Updates multiple dependencies including Rhino, Apache Commons, Jetty, OkHttp, Okio, jsch, and snmp4j-agent
complete/*.sh Removes obsolete shell completion scripts

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

Copy link
Contributor

Copilot AI commented Jan 14, 2026

@nmaguiar I've opened a new pull request, #1619, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits January 14, 2026 03:43
Co-authored-by: nmaguiar <11761746+nmaguiar@users.noreply.github.com>
Fix indentation of _captureStats function in owrap.ai.js
@nmaguiar nmaguiar merged commit a1dcfbd into master Jan 14, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Continuous Enhancement Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

2 participants