Skip to main content
Glama
matthewdtowles

iwantmymtg-mcp

create_price_alert

Set up price alerts for Magic: The Gathering cards to be notified when a card's price rises or falls by a specified percentage.

Instructions

Create a price alert for a card. Supply increasePct, decreasePct, or both (Premium). At least one threshold is required. Requires IWMM_API_KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cardIdYesInternal IWMM card UUID.
increasePctNoTrigger when price increases by at least this percent.
decreasePctNoTrigger when price decreases by at least this percent.

Implementation Reference

  • The createAlertTool object defines the 'create_price_alert' tool with name, description, inputSchema (Zod validation with cardId, increasePct, decreasePct), and a handler that POSTs to '/api/v1/price-alerts' via apiFetch.
    export const createAlertTool = {
      name: "create_price_alert",
      description:
        "Create a price alert for a card. Supply increasePct, decreasePct, or both (Premium). At least one threshold is required. Requires IWMM_API_KEY.",
      inputSchema: z
        .object({
          cardId: z.string().uuid().describe("Internal IWMM card UUID."),
          increasePct: z.number().min(0.01).optional().describe("Trigger when price increases by at least this percent."),
          decreasePct: z.number().min(0.01).optional().describe("Trigger when price decreases by at least this percent."),
        })
        .refine(thresholdRefinement, { message: "Provide at least one of increasePct or decreasePct." }),
      handler: (input: { cardId: string; increasePct?: number; decreasePct?: number }) =>
        apiFetch({ path: "/api/v1/price-alerts", method: "POST", body: input, authenticated: true }),
    };
  • Input schema for create_price_alert using Zod: cardId (UUID string), optional increasePct (number >= 0.01), optional decreasePct (number >= 0.01), with a refinement requiring at least one threshold.
    inputSchema: z
      .object({
        cardId: z.string().uuid().describe("Internal IWMM card UUID."),
        increasePct: z.number().min(0.01).optional().describe("Trigger when price increases by at least this percent."),
        decreasePct: z.number().min(0.01).optional().describe("Trigger when price decreases by at least this percent."),
      })
      .refine(thresholdRefinement, { message: "Provide at least one of increasePct or decreasePct." }),
  • The createAlertTool is imported from './alerts.js' and registered in the tools array at line 80.
    listAlertsTool,
    createAlertTool,
  • The toolsByName map (line 90-92) maps the string 'create_price_alert' to the createAlertTool object for dynamic lookup by name.
    export const toolsByName: Record<string, ToolDefinition> = Object.fromEntries(
      tools.map((t) => [t.name, t]),
    );
  • src/server.ts:32-62 (registration)
    The MCP server's CallToolRequestSchema handler looks up the tool by name from toolsByName, validates args with the schema, and invokes the handler.
    server.setRequestHandler(CallToolRequestSchema, async (req) => {
      const tool = toolsByName[req.params.name];
      if (!tool) {
        return {
          isError: true,
          content: [{ type: "text", text: `Unknown tool: ${req.params.name}` }],
        };
      }
    
      const args = tool.inputSchema.safeParse(req.params.arguments ?? {});
      if (!args.success) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: `Invalid arguments for ${tool.name}: ${args.error.message}`,
            },
          ],
        };
      }
    
      try {
        const result = await tool.handler(args.data);
        return {
          content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
        };
      } catch (err) {
        return { isError: true, content: [{ type: "text", text: formatError(err) }] };
      }
    });
Behavior3/5

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

Discloses that it creates a resource (mutation) and requires an API key. Without annotations, it partially covers behavior but omits details like idempotency, side effects, or error scenarios.

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?

Three concise sentences with no fluff. Front-loaded with purpose, threshold requirements, and auth. Every sentence adds value.

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

Completeness3/5

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

Covers main points but misses expected output (e.g., returns created alert ID). No output schema provided, so description should hint at return. Adequate for simple tool but not fully complete.

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

Parameters4/5

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

Schema coverage is 100%, but description adds critical info: at least one of increasePct or decreasePct is required (beyond schema which only requires cardId). This clarifies usage beyond schema alone.

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?

Clearly states creating a price alert for a card. Specifies the action (create) and resource (price alert). Differentiates from siblings like update_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?

Provides guidance on when to use: requires supply of increasePct, decreasePct, or both, and at least one threshold is mandatory. Mentions API key requirement. Lacks explicit exclusions or alternatives but sufficient for basic usage.

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