Skip to main content
Glama
hiyorineko

Rollbar MCP Server

by hiyorineko

rollbar_list_environments

Retrieve all available environments for a specific Rollbar project to manage error tracking across different deployment stages.

Instructions

List environments from Rollbar

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID

Implementation Reference

  • Handler that resolves the effective project ID and fetches the list of environments from the Rollbar project API.
    case "rollbar_list_environments": {
      // Project Token is required
      if (!projectClient) {
        throw new Error("ROLLBAR_PROJECT_TOKEN is not set, cannot use this API");
      }
    
      const { projectId } = args as { projectId: number };
    
      // Use environment variable project ID as default value, or search by project name
      const effectiveProjectId = await getEffectiveProjectId(projectId);
    
      if (!effectiveProjectId) {
        throw new Error("Project ID is required but not provided in request or environment variables");
      }
    
      const response = await projectClient.get<ListEnvironmentsResponse>(
        `/project/${effectiveProjectId}/environments`,
      );
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(response.data, null, 2),
          },
        ],
      };
    }
  • Input schema for the tool, defining the required projectId parameter.
    const LIST_ENVIRONMENTS_TOOL: Tool = {
      name: "rollbar_list_environments",
      description: "List environments from Rollbar",
      inputSchema: {
        type: "object",
        properties: {
          projectId: { type: "number", description: "Project ID" },
        },
        required: ["projectId"],
      },
    };
  • src/rollbar.ts:298-314 (registration)
    Tool registration in the ListToolsRequestSchema handler by including it in the returned tools list.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        LIST_ITEMS_TOOL,
        GET_ITEM_TOOL,
        GET_ITEM_BY_UUID_TOOL,
        GET_ITEM_BY_COUNTER_TOOL,
        LIST_OCCURRENCES_TOOL,
        GET_OCCURRENCE_TOOL,
        LIST_PROJECTS_TOOL,
        GET_PROJECT_TOOL,
        LIST_ENVIRONMENTS_TOOL,
        LIST_USERS_TOOL,
        GET_USER_TOOL,
        LIST_DEPLOYS_TOOL,
        GET_DEPLOY_TOOL,
      ],
    }));
  • Response type definition for the list environments API call.
    export interface ListEnvironmentsResponse {
      environments: RollbarEnvironment[];
    }
  • Type definition for individual environment objects in the response.
    export interface RollbarEnvironment {
      id: number;
      name: string;
    }

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

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