-
Notifications
You must be signed in to change notification settings - Fork 63
Description
Summary
The tool execution functions (introspect, execute, search, validate) capture input parameters in OpenTelemetry spans but not return values, making it difficult to observe tool outputs in tracing systems like Arize, Jaeger, or any OpenTelemetry-compatible backend.
Current Behavior
The tool functions use #[tracing::instrument(skip(self))] which captures the input parameter as a span attribute, but the CallToolResult return value is not captured:
// crates/apollo-mcp-server/src/introspection/tools/introspect.rs
#[tracing::instrument(skip(self))]
pub async fn execute(&self, input: Input) -> Result<CallToolResult, McpError> {NOTE: Execute tool, doesn't have any sort of instrumentation at all
Result in traces:
inputspan attribute visibleoutput/resultnot visible as span attribute
Proposed Solution
Add ret to the #[tracing::instrument] macro to capture return values:
#[tracing::instrument(skip(self), ret)]
pub async fn execute(&self, input: Input) -> Result<CallToolResult, McpError> {This should be applied to:
introspect.rs-Introspect::execute()execute.rs-Execute::execute()search.rs-Search::execute()validate.rs-Validate::execute()
Benefit
This would make Apollo MCP Server telemetry compatible with OpenInference semantic conventions and observability platforms that expect both input and output on tool spans. Currently, users routing traces to platforms like Arize can see what was requested but not what was returned.