Skip to main content
Glama
zereight

Sentry MCP Server

get_sentry_issue

Retrieve detailed information about a specific Sentry error tracking issue using its ID or URL to analyze and resolve application errors.

Instructions

Get details for a specific Sentry issue using its ID or URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issue_id_or_urlYesThe Sentry issue ID or the full URL of the issue page

Implementation Reference

  • Main execution logic for the 'get_sentry_issue' tool. Validates the input issue ID or URL using parseSentryIssueInput helper, fetches the issue details from the Sentry API, and returns the data as formatted JSON or an error message.
    // --- Start of get_sentry_issue logic ---
    
    const issueInput = request.params.arguments?.issue_id_or_url;
    
    if (typeof issueInput !== 'string') {
      throw new McpError(
        ErrorCode.InvalidParams,
        'Invalid arguments: issue_id_or_url must be a string.'
      );
    }
    
    const parsedInput = parseSentryIssueInput(issueInput);
    
    if (!parsedInput) {
      throw new McpError(
        ErrorCode.InvalidParams,
        `Invalid Sentry issue ID or URL format: ${issueInput}`
      );
    }
    
    const { issueId } = parsedInput;
    
    try {
      // Call Sentry API to get issue info
      const response = await this.axiosInstance.get(`issues/${issueId}/`);
    
      // On success, return issue data as JSON string
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(response.data, null, 2), // Pretty-print
          },
        ],
      };
    } catch (error) {
      let errorMessage = 'Failed to fetch Sentry issue.';
      if (axios.isAxiosError(error)) {
        errorMessage = `Sentry API error: ${error.response?.status} ${error.response?.statusText}. ${JSON.stringify(error.response?.data)}`;
        console.error("Sentry API Error Details:", error.response?.data);
      } else if (error instanceof Error) {
          errorMessage = error.message;
      }
       console.error("Error fetching Sentry issue:", error);
      // On failure, return error message
      return {
        content: [
          {
            type: 'text',
            text: errorMessage,
          },
        ],
        isError: true,
      };
    }
  • Input schema defining the parameters for the 'get_sentry_issue' tool, requiring a string 'issue_id_or_url'.
    inputSchema: {
      type: 'object',
      properties: {
        issue_id_or_url: {
          type: 'string',
          description: 'The Sentry issue ID or the full URL of the issue page',
        },
      },
      required: ['issue_id_or_url'],
    },
  • src/index.ts:116-129 (registration)
    Tool registration in the listTools response, including name, description, and input schema for 'get_sentry_issue'.
    {
      name: 'get_sentry_issue',
      description: 'Get details for a specific Sentry issue using its ID or URL',
      inputSchema: {
        type: 'object',
        properties: {
          issue_id_or_url: {
            type: 'string',
            description: 'The Sentry issue ID or the full URL of the issue page',
          },
        },
        required: ['issue_id_or_url'],
      },
    },
  • Helper function to parse and validate Sentry issue input, extracting numeric issue ID from plain ID or URL format.
    function parseSentryIssueInput(input: string): { issueId: string } | null {
      try {
        // Check if it's a URL format
        if (input.startsWith('http://') || input.startsWith('https://')) {
          const url = new URL(input);
          const pathParts = url.pathname.split('/');
          // e.g., /issues/6380454530/
          const issuesIndex = pathParts.indexOf('issues');
          if (issuesIndex !== -1 && pathParts.length > issuesIndex + 1) {
            const issueId = pathParts[issuesIndex + 1];
            if (/^\d+$/.test(issueId)) { // Check if it consists only of digits
              return { issueId };
            }
          }
        } else if (/^\d+$/.test(input)) { // Check if it's a simple ID format
          return { issueId: input };
        }
      } catch (e) {
        // Ignore URL parsing errors, etc.
        console.error("Error parsing Sentry input:", e);
      }
      return null;
    }

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zereight/sentry-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server