sentry_search_errors_in_file
Identify Sentry errors linked to a specific file or file path. Input the project slug and filename to generate a list of issues for troubleshooting.
Instructions
Search for Sentry errors occurring in a specific file. Find all issues related to a particular file path or filename.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | File path or filename to search for | |
| projectSlug | Yes | Project slug/identifier |
Implementation Reference
- src/index.ts:671-688 (schema)Tool schema definition and registration in the list of available tools returned by ListToolsRequestHandler.{ name: "sentry_search_errors_in_file", description: "Search for Sentry errors occurring in a specific file. Find all issues related to a particular file path or filename.", inputSchema: { type: "object", properties: { projectSlug: { type: "string", description: "Project slug/identifier", }, filename: { type: "string", description: "File path or filename to search for", }, }, required: ["projectSlug", "filename"], }, },
- src/index.ts:1377-1396 (handler)The main handler for the tool within the CallToolRequestSchema switch statement. Extracts parameters, calls the API client method, and returns formatted results.case "sentry_search_errors_in_file": { if (!apiClient) { throw new Error("Sentry API client not initialized. Provide auth token."); } const { projectSlug, filename } = args as any; const issues = await apiClient.searchErrorsInFile(projectSlug, filename); return { content: [ { type: "text", text: `Found ${issues.length} issues in file ${filename}:\n` + issues.map((i: any) => `- ${i.shortId}: ${i.title} (${i.count} events, ${i.userCount} users)` ).join('\n'), }, ], }; }
- src/sentry-api-client.ts:201-204 (helper)Helper method in SentryAPIClient that constructs a Sentry search query for the filename and delegates to listIssues.async searchErrorsInFile(projectSlug: string, filename: string) { const query = `filename:"${filename}"`; return this.listIssues(projectSlug, query); }