feat: get_service_detail#1475
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR refines the MCP tool surface around “service detail” by splitting concerns: introducing a new get_service_detail tool (language + methods) under DetailRegistrar, and renaming the existing “service detail” tool in ServiceRegistrar to get_service_distribution to reflect its actual behavior (provider/consumer application distribution). It also removes an invalid providerAppName from search outputs and addresses a couple of transport-related leak issues, with accompanying test updates.
Changes:
- Added
get_service_detailtool (service language + methods) viaDetailRegistrar, plus unit tests for the new tool. - Renamed
get_service_detail→get_service_distributioninServiceRegistrarand updated references/tests accordingly. - Fixed cancellation/pipe closure leaks in SSE + stdio transport tests; removed invalid
providerAppNamefrom tool result payloads.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/mcp/transport/stdio/stdio_integration_test.go | Closes pipe writer on cancel to avoid stdio goroutine leak in integration test. |
| pkg/mcp/transport/http/sse.go | Ensures SSE handler exits when request context is cancelled (prevents connection leak). |
| pkg/mcp/transport/http/http_test.go | Updates handler signature + NewTextResult usage; adds canceled-context SSE test coverage. |
| pkg/mcp/tools/tools_test.go | Updates registrar expectations (new tool name + adds DetailRegistrar registration test). |
| pkg/mcp/tools/service_discovery.go | Renames tool + handler to get_service_distribution; removes invalid providerAppName from results. |
| pkg/mcp/tools/resource_search.go | Removes invalid providerAppName from service search results; minor formatting alignment changes. |
| pkg/mcp/tools/live_test.go | Updates live tester to call GetServiceDistribution and prints renamed labels. |
| pkg/mcp/tools/integration_test.go | Updates expected tool name and minor struct formatting; import ordering adjusted. |
| pkg/mcp/tools/detail_tools.go | Adds get_service_detail tool registration + handler that returns language/methods. |
| pkg/mcp/tools/detail_tools_test.go | Adds unit tests for get_service_detail and validates get_service_distribution handler registration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import ( | ||
| "encoding/json" | ||
| "testing" | ||
|
|
||
| ctx "context" | ||
| appcfg "github.com/apache/dubbo-admin/pkg/config/app" | ||
| "github.com/apache/dubbo-admin/pkg/mcp/core" | ||
| "github.com/apache/dubbo-admin/pkg/mcp/registry" | ||
| "github.com/apache/dubbo-admin/pkg/mcp/transport/stdio" | ||
| "github.com/apache/dubbo-admin/pkg/mcp/types" | ||
| appcfg "github.com/apache/dubbo-admin/pkg/config/app" | ||
| ctx "context" | ||
| ) |



Please provide a description of this PR:
Changes
get_service_detailtool inDetailRegistrarto return service language and methodsget_service_detailinServiceRegistrartoget_service_distributionto better reflect its purpose (querying provider/consumer app distribution)providerAppNamefield from search resultsdetail_tools_test.goBug fixes
NewTextResultcall inhttp_test.goTo help us figure out who should review this PR, please put an X in all the areas that this PR affects.
Please check any characteristics that apply to this pull request.