[Feature]: Add a find_spans MCP tool (RFC 0016 M7)
Requirement
RFC 0016 §10 calls out a find_spans MCP tool as the reason the RFC exists at all: "An agent investigating a trace can ask for 'the LLM spans in these traces' or 'the spans over two seconds in this service' in one call, where today it searches traces and then reads them." M7, the RFC's last milestone, lists it alongside get_span_details's identity-filter rewiring; the rewiring is done (#9623), find_spans itself is not.
Today an agent that wants spans matching a predicate has to call search_traces (trace summaries only, no spans), then get_span_details (needs trace ID plus span IDs it doesn't have yet) or read whole traces: the two-call detour §10 describes.
Proposal
Add a find_spans MCP tool alongside the existing ones registered in cmd/jaeger/internal/extension/jaegerquery/internal/mcptools/server.go, calling querysvc.QueryService.FindSpans (already used by get_span_details's fast path, cmd/jaeger/internal/extension/jaegerquery/internal/mcptools/internal/handlers/get_span_details.go).
Input shape, mirroring search_traces's flat, LLM-friendly parameters (types.SearchTracesInput) rather than exposing the RFC 0005 filter AST directly to the model:
start_time_min/start_time_max(required: RFC 0016 §4.5 requires a time range on every span search;search_tracesdefaults these,find_spanscannot)service_name,span_name,attributes(map),with_errors,duration_min/duration_max: the same fieldssearch_tracesalready takes
The handler translates these into an expression.Call filter (an AND of Eq/Regex/Exists predicates) the same way get_span_details.go's buildIdentityFilter builds one from Go, rather than parsing a filter expression from the model. A result cap (max_results, mirroring search_traces's MaxSearchResults config knob) bounds the response the same way.
Output: a list of types.SpanDetail (already defined for get_span_details), reused rather than inventing a second span shape.
Backend support is what M3 through M6 deliver (memory done in #9611, pending merge; ES/OS, ClickHouse, remote-storage still open). A backend that doesn't declare SearchCapabilities.SpanSearch refuses the query the same way querysvc.FindSpans already refuses it today (ErrSpanSearchUnsupported). No fallback path is needed here the way get_span_details needs one, since this tool has no pre-RFC-0016 equivalent to fall back to.
Exit
An agent can ask for spans matching service/name/attribute/duration/error criteria across however many traces in one find_spans call, without first searching traces and re-reading them; a backend that cannot serve FindSpans refuses cleanly with the existing ErrSpanSearchUnsupported message. RFC 0016's M7 milestone is fully delivered.
Source: jaegertracing/jaeger