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:
shenyuMcpServerManager.addTool(server.getPath(),
StringUtils.isBlank(mcpServerTool.getName()) ? ruleData.getName() : mcpServerTool.getName(),
...);
During removal, removeRule() always removes by ruleData.getName():
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().
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:During removal,
removeRule()always removes byruleData.getName():If
mcpServerTool.getName()differs fromruleData.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.javahandlerRule()registers by handle tool name when present.removeRule()removes only byruleData.getName().