Skip to main content
Glama
matthewdtowles

iwantmymtg-mcp

update_price_alert

Update an existing price alert by modifying thresholds or toggling its active state. Pass null to clear thresholds (premium only).

Instructions

Update an existing price alert. Pass null for a threshold to clear it (Premium only - free users must keep exactly one direction). isActive toggles enable/disable without deleting. Requires IWMM_API_KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesAlert ID from list_price_alerts.
increasePctNo
decreasePctNo
isActiveNo

Implementation Reference

  • The tool definition and handler for update_price_alert. It accepts id, optional increasePct/decreasePct (nullable to clear), and optional isActive. Handler sends a PATCH request to /api/v1/price-alerts/:id.
    export const updateAlertTool = {
      name: "update_price_alert",
      description:
        "Update an existing price alert. Pass null for a threshold to clear it (Premium only - free users must keep exactly one direction). isActive toggles enable/disable without deleting. Requires IWMM_API_KEY.",
      inputSchema: z.object({
        id: z.string().describe("Alert ID from list_price_alerts."),
        increasePct: z.number().min(0.01).nullable().optional(),
        decreasePct: z.number().min(0.01).nullable().optional(),
        isActive: z.boolean().optional(),
      }),
      handler: ({ id, ...patch }: { id: string } & Record<string, unknown>) =>
        apiFetch({ path: `/api/v1/price-alerts/${encodeURIComponent(id)}`, method: "PATCH", body: patch, authenticated: true }),
  • Zod input schema for update_price_alert: id (required string), increasePct/decreasePct (nullable optional numbers), isActive (optional boolean).
    inputSchema: z.object({
      id: z.string().describe("Alert ID from list_price_alerts."),
      increasePct: z.number().min(0.01).nullable().optional(),
      decreasePct: z.number().min(0.01).nullable().optional(),
      isActive: z.boolean().optional(),
  • The updateAlertTool is registered in the tools array at line 81, making it available for MCP invocation.
    updateAlertTool,
  • toolsByName maps tool names (including 'update_price_alert') to their ToolDefinition for runtime lookup.
    export const toolsByName: Record<string, ToolDefinition> = Object.fromEntries(
      tools.map((t) => [t.name, t]),
    );
  • apiFetch helper used by the handler to make authenticated HTTP PATCH requests to the IWMM API.
    export async function apiFetch<T = unknown>(req: ApiRequest): Promise<T> {
      const url = new URL(req.path, config.baseUrl);
      if (req.query) {
        for (const [k, v] of Object.entries(req.query)) {
          if (v !== undefined && v !== null && v !== "") {
            url.searchParams.set(k, String(v));
          }
        }
      }
    
      const headers: Record<string, string> = {
        Accept: "application/json",
        "User-Agent": "iwantmymtg-mcp/0.0.1",
      };
    
      if (req.authenticated) {
        const { requireApiKey } = await import("./config.js");
        headers["Authorization"] = `Bearer ${requireApiKey()}`;
      }
    
      if (req.body !== undefined) {
        headers["Content-Type"] = "application/json";
      }
    
      const res = await fetch(url, {
        method: req.method ?? "GET",
        headers,
        body: req.body !== undefined ? JSON.stringify(req.body) : undefined,
      });
    
      if (!res.ok) {
        const text = await res.text();
        throw new ApiError(res.status, text, {
          limit: res.headers.get("X-RateLimit-Limit") ?? undefined,
          remaining: res.headers.get("X-RateLimit-Remaining") ?? undefined,
          reset: res.headers.get("X-RateLimit-Reset") ?? undefined,
        });
      }
    
      if (res.status === 204) return undefined as T;
      return (await res.json()) as T;
    }
Behavior4/5

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

No annotations provided, so the description carries the full burden. It discloses authentication requirements (IWMM_API_KEY), the effect of passing null, account type restrictions, and toggling behavior. Minor omission of error behavior but acceptable for an update.

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 only two sentences with no extraneous information. Every word contributes to understanding the tool's behavior.

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

Completeness4/5

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

Given the tool's complexity (4 parameters, no output schema), the description covers key behavioral aspects: null handling, toggling, API key requirement, and account restrictions. It is fairly complete for a simple update tool.

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 low (25%), but the description adds meaning for increasePct and decreasePct by explaining null clears thresholds, and for isActive by describing toggling. It doesn't mention the id parameter beyond the schema. The description partially compensates for the coverage gap.

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 'Update an existing price alert', specifying the verb and resource. It effectively distinguishes from sibling tools like create_price_alert and delete_price_alert.

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?

The description explains when to pass null (for clearing thresholds) and notes the Premium restriction for free users. It also clarifies that isActive toggles enable/disable. It does not explicitly state when not to use, but the context is sufficient.

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/matthewdtowles/iwantmymtg-mcp'

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