[jaegermcp] Log tool name in MCP middleware for tools/call requests#8235
Open
lopster568 wants to merge 1 commit intojaegertracing:mainfrom
Open
[jaegermcp] Log tool name in MCP middleware for tools/call requests#8235lopster568 wants to merge 1 commit intojaegertracing:mainfrom
lopster568 wants to merge 1 commit intojaegertracing:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances Jaeger MCP’s logging middleware to include the invoked tool name for tools/call requests, improving operator visibility into tool-level usage and debugging signals.
Changes:
- Extract tool name from
tools/callrequest params and add it as a structuredtoollog field on both request/response logs. - Refactor logging middleware to build a shared set of log fields reused between request and response log entries.
- Add unit test coverage validating that tool name is present in logs for
tools/callrequests, and refactor test helpers to reduce duplication.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/jaeger/internal/extension/jaegermcp/logging_middleware.go | Adds tool field logging for tools/call via extractToolName and reuses built fields for request/response logs. |
| cmd/jaeger/internal/extension/jaegermcp/logging_middleware_test.go | Adds TestLoggingMiddlewareToolName and introduces request/session helper functions used by logging tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ebdb8a9 to
5300493
Compare
The logging middleware currently logs the MCP method (e.g. "tools/call") but not which tool was invoked. This makes it difficult for operators to identify tool-level usage patterns, latency, and errors from logs alone. Extract the tool name from CallToolParamsRaw on tools/call requests and include it as a "tool" field in both request and response log entries. Signed-off-by: lopster568 <lopster568@users.noreply.github.com> Signed-off-by: Roshan <rosh.s568@gmail.com>
5300493 to
632c37d
Compare
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.
Which problem is this PR solving?
The logging middleware logs the MCP method (e.g.
tools/call) but not which specific tool was invoked. Operators cannot distinguish betweensearch_traces,get_services, orhealthcalls in logs, making it difficult to debug issues or understand tool-level usage patterns.Before:
After:
This aligns with ADR-002 Phase 4 Item 10 (structured logging for debugging).
Description of the changes
CallToolParamsRawwhen the method istools/calltoolfield in both request and response log entriesextractToolNamehelper that returns empty string for non-tool methodsTestLoggingMiddlewareToolNametest that verifies tool name appears in logssendMCPRequest,deleteMCPSession) to reduce duplicationHow was this change tested?
Checklist
make lintandmake testsuccessfully