jaegertracing/jaeger · error
service_name is required
Error message
service_name is required
What it means
The get_span_names MCP handler requires a service name because span names are queried per service. When input.ServiceName is empty it cannot scope the query, so handle returns this sentinel error before calling the query service.
Solutions
- Fetch the available services via get_services and pass one as service_name
- Validate service_name is non-empty in the caller before invoking the tool
- Enforce the required field in the MCP tool input schema
Example fix
// before
out, err := spanNames.Handle(ctx, req, types.GetSpanNamesInput{})
// after
services, _ := getServices.Handle(ctx, req, types.GetServicesInput{})
out, err := spanNames.Handle(ctx, req, types.GetSpanNamesInput{ServiceName: services[0]}) Defensive patterns
Strategy: validation
Validate before calling
if input.ServiceName == "" {
return errors.New("service_name is required before calling get_span_names")
} Try / catch
out, err := handler.Handle(ctx, req, input)
if err != nil && strings.Contains(err.Error(), "service_name is required") {
return fmt.Errorf("call get_services first, then pass one service to get_span_names")
} Prevention
- Resolve service names via get_services before querying span names
- Make service_name required in the tool input schema
- Validate dropdown/form selections are non-empty before dispatching tool calls
When it happens
Trigger: Calling the get_span_names MCP tool with ServiceName omitted or ""; often the caller skipped a prior get_services call and guessed no service.
Common situations: MCP client not enforcing required tool arguments; an LLM assuming span names are global rather than per-service; a UI dropdown left unselected.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01).
Data as JSON: /api/errors/bfe1d7a6ffde6848.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/jaeger/internal/extension/jaegerquery/internal/mcptools/internal/handlers/get_span_names.go:53
// NewGetSpanNamesHandler creates a new get_span_names handler and returns the handler function.
func NewGetSpanNamesHandler(
queryService *querysvc.QueryService,
) mcp.ToolHandlerFor[types.GetSpanNamesInput, types.GetSpanNamesOutput] {
h := &getSpanNamesHandler{
queryService: queryService,
}
return h.handle
}
// handle processes the get_span_names request.
func (h *getSpanNamesHandler) handle(
ctx context.Context,
_ *mcp.CallToolRequest,
input types.GetSpanNamesInput,
) (*mcp.CallToolResult, types.GetSpanNamesOutput, error) {
// Validate service name
if input.ServiceName == "" {
return nil, types.GetSpanNamesOutput{}, errors.New("service_name is required")
}
// Set default limit
limit := input.Limit
if limit <= 0 {
limit = defaultSpanNameLimit
}
// Build query parameters
// Normalize span kind to lowercase because storage backends store span kinds
// in lowercase (e.g., "server") but the MCP schema documents uppercase examples
// (e.g., "SERVER"). Without normalization, uppercase input silently returns
// empty results instead of matching stored operations.
query := tracestore.OperationQueryParams{
ServiceName: input.ServiceName,
SpanKind: strings.ToLower(strings.TrimSpace(input.SpanKind)),
}
View on GitHub (pinned to 806f444784)