Skip to main content
Glama
jaredhobbs

cronalert-mcp

by jaredhobbs

delete_monitor

Permanently remove a CronAlert uptime monitor and its entire check history. This action cannot be undone.

Instructions

Permanently delete a monitor and all its check history. This cannot be undone.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesMonitor ID

Implementation Reference

  • The handler function that executes the delete_monitor tool. It accepts an id parameter and makes a DELETE request to the /monitors/{id} API endpoint, returning the response as JSON.
    async ({ id }) => {
      const data = await apiRequest(`/monitors/${id}`, { method: "DELETE" });
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }
  • src/index.ts:159-175 (registration)
    The complete registration of the delete_monitor tool with the MCP server, including the tool name, description, schema, hints (destructive), and the handler function.
    server.tool(
      "delete_monitor",
      "Permanently delete a monitor and all its check history. This cannot be undone.",
      {
        id: z.string().describe("Monitor ID"),
      },
      {
    
          readOnlyHint: false,
          destructiveHint: true,
          openWorldHint: false,
      },
      async ({ id }) => {
        const data = await apiRequest(`/monitors/${id}`, { method: "DELETE" });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • Zod schema defining the input validation for delete_monitor tool. It requires a single parameter 'id' as a string representing the Monitor ID.
    {
      id: z.string().describe("Monitor ID"),
    },
  • The apiRequest helper function used by delete_monitor handler to make authenticated HTTP requests to the CronAlert API. It handles API key retrieval, request headers, error handling, and JSON response parsing.
    async function apiRequest(
      path: string,
      options: RequestInit = {}
    ): Promise<unknown> {
      const apiKey = getApiKey();
      const url = `${API_BASE}${path}`;
    
      const response = await fetch(url, {
        ...options,
        headers: {
          "Content-Type": "application/json",
          Authorization: `Bearer ${apiKey}`,
          ...options.headers,
        },
      });
    
      if (!response.ok) {
        const body = await response.text();
        throw new Error(`API error ${response.status}: ${body}`);
      }
    
      return response.json();
    }

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/jaredhobbs/cronalert-mcp'

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