Skip to main content
Glama
rollbar

Rollbar MCP Server

Official
by rollbar

list-items

View and filter error tracking items in Rollbar projects by status, severity, environment, or search query to monitor and diagnose issues.

Instructions

List all items in the Rollbar project with optional search and filtering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusNoFilter by item status (e.g., 'active', 'resolved', 'muted') (default: 'active')active
levelNoFilter by severity levels (e.g., ['error', 'critical', 'warning'])
environmentNoFilter by environment (e.g., 'production', 'staging') (default: 'production')production
pageNoPage number for pagination (default: 1)
limitNoNumber of items per page (default: 20, max: 5000)
queryNoSearch query to filter items by title or content
projectNoProject name (optional when only one project is configured)

Implementation Reference

  • The handler function that executes the logic for the "list-items" tool, including parameter parsing, Rollbar API request formation, and response formatting.
      async ({
        status,
        level,
        environment,
        page,
        limit,
        query,
        project,
      }: {
        status?: string;
        level?: string[];
        environment?: string;
        page?: number;
        limit?: number;
        query?: string;
        project?: string;
      }) => {
        const { token, apiBase } = resolveProject(project);
        // Build query parameters
        const params = new URLSearchParams();
    
        if (status) {
          params.append("status", status);
        }
    
        if (level && level.length > 0) {
          level.forEach((l) => params.append("level", l));
        }
    
        if (environment) {
          params.append("environment", environment);
        }
    
        if (page && page > 1) {
          params.append("page", page.toString());
        }
    
        if (limit) {
          params.append("limit", limit.toString());
        }
    
        if (query) {
          params.append("q", query);
        }
    
        const listUrl = `${apiBase}/items/?${params.toString()}`;
    
        const listResponse = await makeRollbarRequest<
          RollbarApiResponse<RollbarListItemsResponse>
        >(listUrl, "list-items", token);
    
        if (listResponse.err !== 0) {
          const errorMessage =
            listResponse.message || `Unknown error (code: ${listResponse.err})`;
          throw new Error(`Rollbar API returned error: ${errorMessage}`);
        }
    
        const itemsData = listResponse.result;
    
        // Format the response to include pagination info and items
        const formattedResponse = {
          items: itemsData.items,
          pagination: {
            page: itemsData.page,
            total_count: itemsData.total_count,
            items_on_page: itemsData.items.length,
          },
          filters_applied: {
            status: status || null,
            level: level || null,
            environment: environment || null,
            query: query || null,
          },
        };
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(formattedResponse),
            },
          ],
        };
      },
    );
  • Zod schema defining the input parameters for the "list-items" tool.
    {
      status: z
        .string()
        .optional()
        .default("active")
        .describe(
          "Filter by item status (e.g., 'active', 'resolved', 'muted') (default: 'active')",
        ),
      level: z
        .array(z.string())
        .optional()
        .describe(
          "Filter by severity levels (e.g., ['error', 'critical', 'warning'])",
        ),
      environment: z
        .string()
        .optional()
        .default("production")
        .describe(
          "Filter by environment (e.g., 'production', 'staging') (default: 'production')",
        ),
      page: z
        .number()
        .int()
        .min(1)
        .optional()
        .default(1)
        .describe("Page number for pagination (default: 1)"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(5000)
        .optional()
        .default(20)
        .describe("Number of items per page (default: 20, max: 5000)"),
      query: z
        .string()
        .optional()
        .describe("Search query to filter items by title or content"),
      project: buildProjectParam(),
    },
  • The registration function for the "list-items" tool within the MCP server.
    export function registerListItemsTool(server: McpServer) {
      server.tool(
        "list-items",
        "List all items in the Rollbar project with optional search and filtering",
        {
          status: z
            .string()
            .optional()
            .default("active")
            .describe(
              "Filter by item status (e.g., 'active', 'resolved', 'muted') (default: 'active')",
            ),
          level: z
            .array(z.string())
            .optional()
            .describe(
              "Filter by severity levels (e.g., ['error', 'critical', 'warning'])",
            ),
          environment: z
            .string()
            .optional()
            .default("production")
            .describe(
              "Filter by environment (e.g., 'production', 'staging') (default: 'production')",
            ),
          page: z
            .number()
            .int()
            .min(1)
            .optional()
            .default(1)
            .describe("Page number for pagination (default: 1)"),
          limit: z
            .number()
            .int()
            .min(1)
            .max(5000)
            .optional()
            .default(20)
            .describe("Number of items per page (default: 20, max: 5000)"),
          query: z
            .string()
            .optional()
            .describe("Search query to filter items by title or content"),
          project: buildProjectParam(),
        },
        async ({
          status,
          level,
          environment,
          page,
          limit,
          query,
          project,
        }: {
          status?: string;
          level?: string[];
          environment?: string;
          page?: number;
          limit?: number;
          query?: string;
          project?: string;
        }) => {
          const { token, apiBase } = resolveProject(project);
          // Build query parameters
          const params = new URLSearchParams();
    
          if (status) {
            params.append("status", status);
          }
    
          if (level && level.length > 0) {
            level.forEach((l) => params.append("level", l));
          }
    
          if (environment) {
            params.append("environment", environment);
          }
    
          if (page && page > 1) {
            params.append("page", page.toString());
          }
    
          if (limit) {
            params.append("limit", limit.toString());
          }
    
          if (query) {
            params.append("q", query);
          }
    
          const listUrl = `${apiBase}/items/?${params.toString()}`;
    
          const listResponse = await makeRollbarRequest<
            RollbarApiResponse<RollbarListItemsResponse>
          >(listUrl, "list-items", token);
    
          if (listResponse.err !== 0) {
            const errorMessage =
              listResponse.message || `Unknown error (code: ${listResponse.err})`;
            throw new Error(`Rollbar API returned error: ${errorMessage}`);
          }
    
          const itemsData = listResponse.result;
    
          // Format the response to include pagination info and items
          const formattedResponse = {
            items: itemsData.items,
            pagination: {
              page: itemsData.page,
              total_count: itemsData.total_count,
              items_on_page: itemsData.items.length,
            },
            filters_applied: {
              status: status || null,
              level: level || null,
              environment: environment || null,
              query: query || null,
            },
          };
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(formattedResponse),
              },
            ],
          };
        },
      );
    }

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/rollbar/rollbar-mcp-server'

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