get-item-details
Retrieve detailed information about specific error items in Rollbar for troubleshooting and monitoring purposes.
Instructions
Get item details for a Rollbar item
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| counter | Yes | Rollbar item counter | |
| max_tokens | No | Maximum tokens for occurrence data in response (default: 20000). Occurrence response will be truncated if it exceeds this limit. | |
| project | No | Project name (optional when only one project is configured) |
Implementation Reference
- src/tools/get-item-details.ts:29-83 (handler)The async handler function for the get-item-details tool, which fetches item details from the Rollbar API using a counter and occurrence ID, processes the response, and truncates the data.
async ({ counter, max_tokens, project }) => { const { token, apiBase } = resolveProject(project); // Redirects are followed, so we get an item response from the counter request const counterUrl = `${apiBase}/item_by_counter/${counter}`; const itemResponse = await makeRollbarRequest< RollbarApiResponse<RollbarItemResponse> >(counterUrl, "get-item-details", token); if (itemResponse.err !== 0) { const errorMessage = itemResponse.message || `Unknown error (code: ${itemResponse.err})`; throw new Error(`Rollbar API returned error: ${errorMessage}`); } const item = itemResponse.result; const occurrenceUrl = `${apiBase}/instance/${item.last_occurrence_id}`; const occurrenceResponse = await makeRollbarRequest< RollbarApiResponse<RollbarOccurrenceResponse> >(occurrenceUrl, "get-item-details", token); if (occurrenceResponse.err !== 0) { // We got the item but failed to get occurrence. Return just the item data. return { content: [ { type: "text", text: JSON.stringify(item), }, ], }; } const occurrence = occurrenceResponse.result; // Remove the metadata section from occurrence.data if (occurrence.data && occurrence.data.metadata) { delete occurrence.data.metadata; } // Combine item and occurrence data const responseData = { ...item, occurrence: truncateOccurrence(occurrence, max_tokens), }; return { content: [ { type: "text", text: JSON.stringify(responseData), }, ], }; }, - src/tools/get-item-details.ts:17-28 (schema)The Zod schema definition for the get-item-details tool inputs (counter, max_tokens, project).
{ counter: z.number().int().describe("Rollbar item counter"), max_tokens: z .number() .int() .optional() .default(20000) .describe( "Maximum tokens for occurrence data in response (default: 20000). Occurrence response will be truncated if it exceeds this limit.", ), project: buildProjectParam(), }, - src/tools/get-item-details.ts:13-85 (registration)The registration function that defines the get-item-details tool within the MCP server.
export function registerGetItemDetailsTool(server: McpServer) { server.tool( "get-item-details", "Get item details for a Rollbar item", { counter: z.number().int().describe("Rollbar item counter"), max_tokens: z .number() .int() .optional() .default(20000) .describe( "Maximum tokens for occurrence data in response (default: 20000). Occurrence response will be truncated if it exceeds this limit.", ), project: buildProjectParam(), }, async ({ counter, max_tokens, project }) => { const { token, apiBase } = resolveProject(project); // Redirects are followed, so we get an item response from the counter request const counterUrl = `${apiBase}/item_by_counter/${counter}`; const itemResponse = await makeRollbarRequest< RollbarApiResponse<RollbarItemResponse> >(counterUrl, "get-item-details", token); if (itemResponse.err !== 0) { const errorMessage = itemResponse.message || `Unknown error (code: ${itemResponse.err})`; throw new Error(`Rollbar API returned error: ${errorMessage}`); } const item = itemResponse.result; const occurrenceUrl = `${apiBase}/instance/${item.last_occurrence_id}`; const occurrenceResponse = await makeRollbarRequest< RollbarApiResponse<RollbarOccurrenceResponse> >(occurrenceUrl, "get-item-details", token); if (occurrenceResponse.err !== 0) { // We got the item but failed to get occurrence. Return just the item data. return { content: [ { type: "text", text: JSON.stringify(item), }, ], }; } const occurrence = occurrenceResponse.result; // Remove the metadata section from occurrence.data if (occurrence.data && occurrence.data.metadata) { delete occurrence.data.metadata; } // Combine item and occurrence data const responseData = { ...item, occurrence: truncateOccurrence(occurrence, max_tokens), }; return { content: [ { type: "text", text: JSON.stringify(responseData), }, ], }; }, ); }