Skip to content

Add support for showing variables #871

Open

Description

@bendavis78

Problem:

get_issue_details returns stack frames with file, line, function, and source code, but not local variable values — even when Sentry has captured them. Without variable context, the assistant can't actually diagnose the issue — it has to punt back to the human to check the UI. That defeats the purpose of the MCP integration.

I ran into this today. We had an EncodeError: Object of type str is not JSON serializable in a Celery/Kombu stack. In the Sentry web UI, I can see the value of o at the crash site (json/encoder.py:180) — it was a SimpleLazyObject. That's the whole answer to "what was being encoded?" But the MCP tool only gave me frame metadata, so I had to leave the AI workflow and go look at the UI myself.

Proposed solution:

Rather than bloating every get_issue_details response with variables from every frame, add a separate tool like get_frame_variables(issue_id, event_id, frame_index) that returns the local variables for a specific stack frame. This keeps the common case token-efficient while still letting the assistant drill into the frame that matters.

Another option to save on # of requests might be to include variable data only for the top/bottom frame of each exception by default, since that's where the most useful context usually lives.

Activity

  1. sentry-junior commented on Nov 10, 2026

    @sentry-junior
    Contributor

    Another report of this, now that variables are shown but cut short (MCP feedback MCP-SERVER-GN2, hosted server 0.42.0, Claude).

    The agent needed one nested local (response_json, an API error body like {"errors":[{"carrier_code":…,"carrier_id":…,"error_code":…,"message":…}],"request_id":…}) from the top in-app frame of each event, to classify causes. get_sentry_resource / get_issue_details rendered it as:

    ├─ response_json: {"errors":[{"carrier_code":"'fedex'","carrier_id":"'unknown'", ...}
    

    so error_code and message never appear, and no tool returns a single frame's variables or the raw event.

    • Cause: formatVariableValue(value, maxLength = 80) stringifies objects and cuts at 80 chars (packages/mcp-core/src/internal/formatting.ts:853-883), used by renderVariablesTable (:907-922).
    • feat(mcp): Return structured get_issue_details for every event type #2041 (open) moves vars into structured output with a 200-char cut. That helps, but a nested error body like this one can still be cut, so it doesn't fully cover the per-frame drill-down asked for here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions