avichaym opened a new issue, #538:
URL: https://github.com/apache/flink-agents/issues/538

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/flink-agents/issues) and found nothing 
similar.
   
   ### Description
   
   PR #447 (linked to #412) fixed this for Python agents, but the same bug 
exists in the Java path.
   
   When using @MCPServer in a Java agent with an MCP server that only supports 
tools (not prompts), AgentPlan.extractJavaMCPServer fails during agent plan 
creation with:
   
   io.modelcontextprotocol.spec.McpError: Method not found
   JSONRPCError[code=-32601, message=Method not found, data=null]
   
   Root cause: extractJavaMCPServer (line 436) calls listPrompts() 
unconditionally via reflection, ignoring the server's ServerCapabilities which 
declares prompts=null.
   
   Impact: Any Java agent using @MCPServer with a tools-only MCP server (e.g., 
Amazon Bedrock AgentCore Gateway) cannot create an agent plan. Tools are 
discovered successfully, but the unconditional listPrompts call crashes plan 
creation.
   
   Steps to Reproduce:
   1. Create a Java agent with @MCPServer pointing to an MCP server that only 
supports tools
   2. Run the agent — fails during plan creation with McpError: Method not found
   
   Expected: Agent plan creation succeeds, prompts are simply not registered 
(matching the Python behavior after #447).
   
   
   
   ### How to reproduce
   
   Steps to Reproduce:
   1. Create a Java agent with @MCPServer pointing to an MCP server that only 
supports tools
   2. Run the agent — fails during plan creation with McpError: Method not found
   
   ### Version and environment
   
   - Flink Agents: 0.3-SNAPSHOT (main branch, commit 7db1157)
   - MCP Java SDK: 0.16.0 (bundled in flink-agents-dist)
   - Flink: 1.20.0
   - Java: 11+ (reproduced on 17 and 23)
   - OS: macOS (also reproducible on Linux CI)
   - MCP Server: Amazon Bedrock AgentCore Gateway (any tools-only MCP server 
triggers this)
   
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!


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