Skip to content

feat: get_service_detail#1475

Open
nagisa-kunhah wants to merge 1 commit into
apache:aifrom
nagisa-kunhah:feat/mcp-detail-tools
Open

feat: get_service_detail#1475
nagisa-kunhah wants to merge 1 commit into
apache:aifrom
nagisa-kunhah:feat/mcp-detail-tools

Conversation

@nagisa-kunhah
Copy link
Copy Markdown

Please provide a description of this PR:

Changes

  • Add get_service_detail tool in DetailRegistrar to return service language and methods
  • Rename get_service_detail in ServiceRegistrar to get_service_distribution to better reflect its purpose (querying provider/consumer app distribution)
  • Remove invalid providerAppName field from search results
  • Add unit tests for detail_tools_test.go

Bug fixes

  • Fix SSE connection leak when request context is cancelled
  • Fix goroutine leak from unclosed pipe in stdio integration test
  • Fix handler signature and NewTextResult call in http_test.go
  • Code formatting (import ordering, map literal alignment)

To help us figure out who should review this PR, please put an X in all the areas that this PR affects.

  • Docs
  • Installation
  • User Experience
  • Dubboctl
  • Console
  • Core Component

Please check any characteristics that apply to this pull request.

@sonarqubecloud
Copy link
Copy Markdown

@nagisa-kunhah nagisa-kunhah marked this pull request as ready for review May 21, 2026 16:48
@robocanic robocanic requested a review from Copilot May 24, 2026 11:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_detail tool (service language + methods) via DetailRegistrar, plus unit tests for the new tool.
  • Renamed get_service_detailget_service_distribution in ServiceRegistrar and updated references/tests accordingly.
  • Fixed cancellation/pipe closure leaks in SSE + stdio transport tests; removed invalid providerAppName from 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.

Comment on lines 20 to 30
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"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants