Aias00 opened a new issue, #6473:
URL: https://github.com/apache/shenyu/issues/6473

   ### Current Behavior
   
   MCP tool registration and removal use different names when the rule handle 
defines a custom tool name.
   
   During registration, `handlerRule()` prefers the tool name from the rule 
handle and only falls back to the rule name:
   
   ```java
   shenyuMcpServerManager.addTool(server.getPath(),
           StringUtils.isBlank(mcpServerTool.getName()) ? ruleData.getName() : 
mcpServerTool.getName(),
           ...);
   ```
   
   During removal, `removeRule()` always removes by `ruleData.getName()`:
   
   ```java
   shenyuMcpServerManager.removeTool(server.getPath(), ruleData.getName());
   ```
   
   If `mcpServerTool.getName()` differs from `ruleData.getName()`, deleting or 
updating the rule removes the cache entry but leaves the live MCP server tool 
registered under the custom name.
   
   ### Expected Behavior
   
   Rule removal should remove the same tool name that was used during 
registration.
   
   ### Impact
   
   Renamed/custom-named MCP tools can remain callable after the backing rule is 
removed or updated, leaving stale tool definitions in the live MCP server.
   
   ### Code Location
   
   - 
`shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/handler/McpServerPluginDataHandler.java`
     - `handlerRule()` registers by handle tool name when present.
     - `removeRule()` removes only by `ruleData.getName()`.
   


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