yanand0909 opened a new pull request, #639:
URL: https://github.com/apache/flink-agents/pull/639

   <!--
   * Thank you very much for contributing to Flink Agents.
   * Please add the relevant components in the PR title. E.g., [api], 
[runtime], [java], [python], [hotfix], etc.
   -->
   
   <!-- Please link the PR to the relevant issue(s). Hotfix doesn't need this. 
-->
   Linked issue: [608](https://github.com/apache/flink-agents/issues/608)
   
   ### Purpose of change
   
   MCP tools and prompts were previously discovered at compile time inside 
AgentPlan.extractJavaMCPServer(): an MCPServer connection was opened, 
listTools()/listPrompts() were called over the network, results were serialized 
into the plan, and the connection was immediately closed. This had three 
problems:
   
     1. Build-time server dependency — AgentPlan construction failed if the MCP 
server was unreachable, even though the agent wouldn't run until later.
     2. Static capabilities — Tools and prompts were frozen at compile time; 
any server-side changes required recompilation.
     3. No connection reuse — The connection opened for discovery was closed 
immediately; a new one was established later for actual tool calls.
   
   This PR implements Part 1: Runtime Discovery from discussion #543. MCP tool 
and prompt discovery is moved from AgentPlan construction to 
ActionExecutionOperator.open():
   
   ### Tests
   
     - AgentPlanDeclareMCPServerTest — Updated to assert the new compile-time 
contract: TOOL and PROMPT providers are absent from AgentPlan providers 
(deferred to runtime), only MCP_SERVER is registered. Tool/prompt retrieval 
tests now instantiate the MCPServer directly from the plan's provider, 
simulating what JavaMCPResourceDiscovery does at operator startup.
     - JavaMCPResourceDiscoveryTest (new) — Six unit tests covering 
JavaMCPResourceDiscovery with stub objects (no live server required):
       - Happy path: tools and prompts are discovered and placed in 
ResourceCache
       - supportsPrompts() = false: prompt discovery is skipped
       - Non-JavaResourceProvider entries are ignored
   
   ### API
   
   No public API changes
   
   ### Documentation
   
   <!-- Do not remove this section. Check the proper box only. -->
   
   - [ ] `doc-needed` <!-- Your PR changes impact docs -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-included` <!-- Your PR already contains the necessary 
documentation updates -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to