Skip to main content
Glama

unsubscribe

Cancel a persistent monitor watch by providing its ID to stop notifications.

Instructions

Cancel a persistent watch (monitor). Use the monitor ID returned from subscribe.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
monitorIdYesMonitor ID from subscribe (e.g., 'mon_...')

Implementation Reference

  • src/index.ts:838-878 (registration)
    The tool 'unsubscribe' is registered via server.tool() with zod schema for monitorId input.
    server.tool(
      "unsubscribe",
      "Cancel a persistent watch (monitor). Use the monitor ID returned from subscribe.",
      {
        monitorId: z.string().min(1).describe("Monitor ID from subscribe (e.g., 'mon_...')"),
      },
      async ({ monitorId }) => {
        log("unsubscribe", monitorId);
        try {
          const headers: Record<string, string> = {};
          if (API_KEY) headers["X-API-Key"] = API_KEY;
    
          const controller = new AbortController();
          const timeout = setTimeout(() => controller.abort(), 15_000);
    
          try {
            const res = await fetch(`${API_BASE}/api/v1/monitor?id=${encodeURIComponent(monitorId)}`, {
              method: "DELETE",
              headers,
              signal: controller.signal,
            });
    
            if (!res.ok) {
              const data = await res.json();
              throw new Error(data.error || `API error ${res.status}`);
            }
    
            return {
              content: [{ type: "text" as const, text: `Monitor ${monitorId} cancelled. You will no longer receive alerts for this watch.` }],
            };
          } finally {
            clearTimeout(timeout);
          }
        } catch (err) {
          return {
            content: [{ type: "text" as const, text: `Error cancelling monitor: ${err instanceof Error ? err.message : String(err)}` }],
            isError: true,
          };
        }
      }
    );
  • The async handler function for 'unsubscribe' – sends a DELETE request to /api/v1/monitor with the monitorId and returns a cancellation message.
    async ({ monitorId }) => {
      log("unsubscribe", monitorId);
      try {
        const headers: Record<string, string> = {};
        if (API_KEY) headers["X-API-Key"] = API_KEY;
    
        const controller = new AbortController();
        const timeout = setTimeout(() => controller.abort(), 15_000);
    
        try {
          const res = await fetch(`${API_BASE}/api/v1/monitor?id=${encodeURIComponent(monitorId)}`, {
            method: "DELETE",
            headers,
            signal: controller.signal,
          });
    
          if (!res.ok) {
            const data = await res.json();
            throw new Error(data.error || `API error ${res.status}`);
          }
    
          return {
            content: [{ type: "text" as const, text: `Monitor ${monitorId} cancelled. You will no longer receive alerts for this watch.` }],
          };
        } finally {
          clearTimeout(timeout);
        }
      } catch (err) {
        return {
          content: [{ type: "text" as const, text: `Error cancelling monitor: ${err instanceof Error ? err.message : String(err)}` }],
          isError: true,
        };
      }
    }
  • Input schema for 'unsubscribe': a single required string parameter 'monitorId' with min length 1.
    {
      monitorId: z.string().min(1).describe("Monitor ID from subscribe (e.g., 'mon_...')"),
    },
Behavior3/5

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

No annotations provided, so description carries full burden. States it cancels a watch but lacks details on effects (e.g., reversibility, permissions). Adequate but minimal.

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?

Two short sentences, direct, no unnecessary words. Efficiently conveys purpose and key usage hint.

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

Completeness5/5

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

Simple tool with one required parameter and no output schema. Description covers what it does and where to get the ID, making it complete for correct use.

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 description covers 100% of parameter with example. Description adds 'Use the monitor ID returned from subscribe' which adds slight context but mostly redundant. Baseline 3 as schema is sufficient.

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?

Description clearly specifies the action 'cancel a persistent watch (monitor)' and distinguishes from sibling 'subscribe' which creates the watch. Verb and resource are specific.

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

Usage Guidelines4/5

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

Explicitly instructs to use the monitor ID from subscribe, providing clear source for the parameter. Does not explicitly state when not to use, but context is sufficient for this simple tool.

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

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