Skip to main content
Glama
suthio

Redash MCP Server

by suthio

add_alert_subscription

Subscribe to an alert to receive notifications when it triggers. Specify the alert ID; optionally select a destination (defaults to email).

Instructions

Subscribe to an alert to receive notifications

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
alertIdYesID of the alert to subscribe to
destination_idNoID of the notification destination (optional, defaults to email)

Implementation Reference

  • Handler function for the 'add_alert_subscription' tool. Parses input via addAlertSubscriptionSchema, optionally sets destination_id from params, and calls redashClient.addAlertSubscription(). Returns the subscription result or an error.
    // Tool: add_alert_subscription
    const addAlertSubscriptionSchema = z.object({
      alertId: z.coerce.number(),
      destination_id: z.coerce.number().optional()
    });
    
    async function addAlertSubscription(params: z.infer<typeof addAlertSubscriptionSchema>) {
      try {
        const subscriptionData: CreateAlertSubscriptionRequest = {};
        if (params.destination_id !== undefined) subscriptionData.destination_id = params.destination_id;
    
        const result = await redashClient.addAlertSubscription(params.alertId, subscriptionData);
        return {
          content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
        };
      } catch (error) {
        logger.error(`Error adding subscription to alert ${params.alertId}: ${error}`);
        return {
          isError: true,
          content: [{ type: "text", text: `Error adding subscription to alert ${params.alertId}: ${error instanceof Error ? error.message : String(error)}` }]
        };
      }
    }
  • Zod schema for add_alert_subscription input validation: requires alertId (number) and optionally destination_id (number).
    const addAlertSubscriptionSchema = z.object({
      alertId: z.coerce.number(),
      destination_id: z.coerce.number().optional()
    });
  • TypeScript type (CreateAlertSubscriptionRequest) defining the request body shape: optional destination_id.
    export interface CreateAlertSubscriptionRequest {
      destination_id?: number;
    }
  • Client helper method addAlertSubscription() that POSTs to /api/alerts/{alertId}/subscriptions with optional subscription data.
    // Add alert subscription
    async addAlertSubscription(alertId: number, data?: CreateAlertSubscriptionRequest): Promise<AlertSubscription> {
      try {
        const response = await this.client.post(`/api/alerts/${alertId}/subscriptions`, data || {});
        return response.data;
      } catch (error) {
        logger.error(`Error adding subscription to alert ${alertId}: ${error}`);
        throw new Error(`Failed to add subscription to alert ${alertId}: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • src/index.ts:2475-2477 (registration)
    MCP tool dispatch: case 'add_alert_subscription' in the CallToolRequestSchema handler routes the request to addAlertSubscription() with validated args.
    case "add_alert_subscription":
      logger.debug(`Handling add_alert_subscription`);
      return await addAlertSubscription(addAlertSubscriptionSchema.parse(args));
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description should disclose side effects (e.g., overwriting previous subscriptions), permissions, or return values, but it only states the obvious purpose.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single concise sentence with no fluff; front-loaded with purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and missing behavioral details, the description fails to explain what happens after subscription (e.g., confirmation, effects on existing subscriptions).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and both parameters have descriptions; the description adds no extra meaning beyond the schema, so baseline is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's action (subscribe) and resource (alert), and it is distinct from sibling tools like remove_alert_subscription or mute_alert.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like mute_alert or remove_alert_subscription; no context on prerequisites or expected behavior.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/suthio/redash-mcp'

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