Skip to main content
Glama

unsubscribe

Cancel blockchain event subscriptions to stop receiving updates and manage notification preferences in the Alchemy MCP Plugin.

Instructions

Unsubscribe from blockchain events

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subscriptionIdYesThe ID of the subscription to cancel

Implementation Reference

  • The main handler function for the 'unsubscribe' tool. It validates the input parameters, retrieves the subscription from the activeSubscriptions map, calls unsubscribe on it, removes it from the map, and returns success.
    private async handleUnsubscribe(args: Record<string, unknown>) {
      const params = this.validateAndCastParams<UnsubscribeParams>(
        args,
        isValidUnsubscribeParams,
        "Invalid unsubscribe parameters"
      );
    
      const subscription = this.activeSubscriptions.get(params.subscriptionId);
      if (!subscription) {
        throw new McpError(
          ErrorCode.InvalidParams,
          `Subscription not found: ${params.subscriptionId}`
        );
      }
    
      subscription.unsubscribe();
      this.activeSubscriptions.delete(params.subscriptionId);
      return { success: true };
    }
  • index.ts:962-975 (registration)
    Registration of the 'unsubscribe' tool in the ListTools response, defining its name, description, and input schema.
    {
      name: "unsubscribe",
      description: "Unsubscribe from blockchain events",
      inputSchema: {
        type: "object",
        properties: {
          subscriptionId: {
            type: "string",
            description: "The ID of the subscription to cancel",
          },
        },
        required: ["subscriptionId"],
      },
    },
  • TypeScript type definition for the input parameters of the unsubscribe tool.
    type UnsubscribeParams = {
      subscriptionId: string;
    };
  • Validation helper function to check if arguments match UnsubscribeParams type.
    const isValidUnsubscribeParams = (args: any): args is UnsubscribeParams => {
      return (
        typeof args === "object" &&
        args !== null &&
        typeof args.subscriptionId === "string"
      );
    };
  • Dispatch case in the CallToolRequest handler that routes to the unsubscribe handler.
    case "unsubscribe":
      result = await this.handleUnsubscribe(request.params.arguments);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action but doesn't cover critical aspects like whether this is a destructive operation, permission requirements, error conditions, or what happens after unsubscribing. This is inadequate for a mutation tool with zero annotation coverage.

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?

The description is extremely concise with just four words, front-loading the core action without any wasted words. It efficiently communicates the tool's purpose in minimal space.

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 this is a mutation tool with no annotations and no output schema, the description is incomplete. It lacks information about behavioral traits, error handling, and what to expect after invocation, which is insufficient for an agent to use it effectively in context.

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 coverage is 100%, with the single parameter 'subscriptionId' well-documented in the schema. The description adds no additional parameter information beyond what the schema provides, so it meets the baseline of 3 for high schema coverage without extra value.

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

Purpose4/5

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

The description clearly states the verb ('Unsubscribe from') and resource ('blockchain events'), providing a specific action. However, it doesn't explicitly differentiate from its sibling 'subscribe' beyond the opposite action, missing an opportunity to clarify the relationship between these two tools.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing subscription), nor does it reference the sibling 'subscribe' tool for context, leaving the agent without usage context.

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/itsanishjain/alchemy-sdk-mcp'

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