[mcp] get_services tool for service discovery#7864
Merged
yurishkuro merged 4 commits intomainfrom Jan 12, 2026
Merged
Conversation
Co-authored-by: yurishkuro <3523016+yurishkuro@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add get_service tool to enhance search_traces functionality
Add get_services MCP tool for service discovery (Part of #7827)
Jan 11, 2026
yurishkuro
requested changes
Jan 11, 2026
cmd/jaeger/internal/extension/jaegermcp/internal/handlers/get_services.go
Show resolved
Hide resolved
- Add sort.Strings() before limit application for consistent results - Update tests to reflect alphabetically sorted output - Addresses review feedback on line 74 Co-authored-by: yurishkuro <3523016+yurishkuro@users.noreply.github.com>
yurishkuro
approved these changes
Jan 11, 2026
jaegertracingbot
approved these changes
Jan 11, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7864 +/- ##
==========================================
- Coverage 95.48% 95.48% -0.01%
==========================================
Files 304 305 +1
Lines 16125 16156 +31
==========================================
+ Hits 15397 15426 +29
- Misses 570 571 +1
- Partials 158 159 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
yurishkuro
requested changes
Jan 11, 2026
cmd/jaeger/internal/extension/jaegermcp/internal/handlers/get_services.go
Show resolved
Hide resolved
- Added TestNewGetServicesHandler that calls the constructor function - Improves code coverage from 0% to 100% for NewGetServicesHandler - Addresses review feedback on line 32 Co-authored-by: yurishkuro <3523016+yurishkuro@users.noreply.github.com>
Manik2708
pushed a commit
to Manik2708/jaeger
that referenced
this pull request
Jan 20, 2026
## Implementation Complete: get_services MCP Tool (Part of jaegertracing#7827) - [x] Create types file (`get_services.go`) in `internal/types/` directory - [x] Create handler file (`get_services.go`) in `internal/handlers/` directory - [x] Create comprehensive test file (`get_services_test.go`) with 12 test cases - [x] Register `get_services` tool at the top of `registerTools()` function in `server.go` - [x] Update ADR-002 to mark `get_services` as completed in Phase 2 - [x] Run `make fmt` - ✅ passed successfully - [x] Run `make lint` - ✅ passed with 0 issues - [x] Run `make test` - ✅ all tests pass (12/12 for get_services) - [x] Verify code coverage > 95% - ✅ 100% coverage for both functions - [x] Final verification - ✅ module compiles and all tests pass - [x] Sort services before applying limit for consistent results - [x] Add test for NewGetServicesHandler constructor function ## Summary Successfully implemented the `get_services` MCP tool as requested in issue jaegertracing#7827. This tool enables users to discover available service names, which is essential for using `search_traces` since it requires a service_name parameter. ### Key Features: - **Service Discovery**: Lists all available service names from storage - **Pattern Filtering**: Supports regex pattern matching for filtering services - **Limit Control**: Configurable limit (default: 100 services) - **Consistent Ordering**: Services are sorted alphabetically before applying limit - **Comprehensive Error Handling**: Invalid patterns, storage failures, edge cases - **100% Test Coverage**: 12 test cases covering all scenarios including constructor ### Files Changed: - **3 new files** created (types, handler, tests) - **2 files** modified (server.go, ADR-002) ### Tool Position: Registered at the **top** of `registerTools()` as required, making it the first tool users encounter. This is critical because `search_traces` depends on service names discovered through this tool. ### Testing: - All 12 get_services tests pass - All existing MCP tests continue to pass - No regressions introduced - Code quality verified with fmt and lint - 100% code coverage for all functions This implementation completes the requirements from issue jaegertracing#7827. <!-- START COPILOT CODING AGENT SUFFIX --> <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > jaegertracing#7827 > > we're missing get_service tool, whichout which search_traces is not useful since it requires a service name. Add this tool to the ADR-002 in all relevant places and implement. The input should accept an optional regex to filter the list of services. The tool should be at the top inside registerTools() function. > > State Part of jaegertracing#7827 in the PR description. Run make fmt make lint and make test to success everytime before pushing to remove branch. Ensure code coverage for new code over 95%. Update ADR to reflect progress. </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: yurishkuro <3523016+yurishkuro@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implementation Complete: get_services MCP Tool (Part of #7827)
get_services.go) ininternal/types/directoryget_services.go) ininternal/handlers/directoryget_services_test.go) with 12 test casesget_servicestool at the top ofregisterTools()function inserver.goget_servicesas completed in Phase 2make fmt- ✅ passed successfullymake lint- ✅ passed with 0 issuesmake test- ✅ all tests pass (12/12 for get_services)Summary
Successfully implemented the
get_servicesMCP tool as requested in issue #7827. This tool enables users to discover available service names, which is essential for usingsearch_tracessince it requires a service_name parameter.Key Features:
Files Changed:
Tool Position:
Registered at the top of
registerTools()as required, making it the first tool users encounter. This is critical becausesearch_tracesdepends on service names discovered through this tool.Testing:
This implementation completes the requirements from issue #7827.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.