Skip to content

AI Assistant search_traces tool silently overwrites user-provided error attribute when with_errors is true #9176

Description

@Harizz076

What happened?

When querying traces using the AI Assistant's search_traces
MCP tool, providing an explicit attributes filter for error
(e.g., "error": "false") alongside with_errors: true results
in the user's manual filter being silently clobbered.

The buildQueryParams function unconditionally sets
attributes["error"] = "true" if WithErrors is enabled,
regardless of whether the user explicitly requested a
conflicting attribute value in the same query. This results
in the backend querying for traces with error=true without
warning the user that their error=false filter was ignored.

Steps to reproduce

  1. Invoke the AI Assistant's search_traces tool.

  2. Provide a query input that explicitly sets the error
    attribute to "false" while simultaneously setting
    with_errors to true:

    {
    "service_name": "my-service",
    "attributes": {
    "error": "false"
    },
    "with_errors": true
    }

  3. Observe that the search executes for traces containing
    errors, completely ignoring the manual error=false filter.

Expected behavior

The system should surface the conflict to the caller rather
than silently choosing a behavior. If with_errors: true is
set, and attributes["error"] is explicitly set to anything
other than "true", the handler should fail fast and return
a clear validation error.

Relevant log output

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions