eemario commented on code in PR #1303:
URL: https://github.com/apache/flink-agents/pull/1303#discussion_r4335134814


##########
plan/src/main/java/org/apache/flink/agents/plan/AgentPlan.java:
##########
@@ -661,12 +661,18 @@ private void extractResourceProvidersFromAgent(Agent 
agent) throws Exception {
                     }
                 }
             } else if (type == MCP_SERVER) {
-                if (!entry.getValue().isEmpty()) {
-                    throw new UnsupportedOperationException(
-                            "Adding an MCP server via Agent.addResource is not 
supported."
-                                    + " Declare the MCP server with a 
@MCPServer-annotated static"
-                                    + " method on your Agent class so its 
tools and prompts can be"
-                                    + " discovered.");
+                for (Map.Entry<String, Object> kv : 
entry.getValue().entrySet()) {
+                    String name = kv.getKey();
+                    ResourceDescriptor descriptor =
+                            requireResourceDescriptor(name, type, 
kv.getValue());
+                    if (!isPythonResource(descriptor)) {
+                        throw new UnsupportedOperationException(
+                                "Adding a Java MCP server via 
Agent.addResource is not supported."
+                                        + " Declare it with a 
@MCPServer-annotated static method on"
+                                        + " your Agent class so its tools and 
prompts can be"
+                                        + " discovered.");
+                    }
+                    addResourceProvider(new PythonResourceProvider(name, 
MCP_SERVER, descriptor));

Review Comment:
   Thanks for the review! I removed the MCP-specific override so the provider 
now honors the descriptor’s module and class, and added a test covering this 
behavior.



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