Skip to main content
Glama

w3_coupon_create

Create or claim a coupon using a unique claim code on the MCP IPFS Server, enabling secure and efficient coupon management for storacha.network spaces.

Instructions

Attempts to create/claim a coupon using a claim code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
claimCodeYesThe claim code for the coupon.

Implementation Reference

  • The main execution logic for the w3_coupon_create tool. Validates arguments with the schema, runs the 'w3 coupon create' command using the claimCode, and formats the stdout as a text content response.
    const handleW3CouponCreate: ToolHandler = async (args) => {
      const parsed = Schemas.W3CouponCreateArgsSchema.safeParse(args);
      if (!parsed.success)
        throw new Error(
          `Invalid arguments for w3_coupon_create: ${parsed.error.message}`
        );
      const { claimCode } = parsed.data;
      const { stdout } = await runW3Command(`coupon create ${claimCode}`);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              message: "Attempted to claim coupon.",
              output: stdout.trim(),
            }),
          },
        ],
      };
    };
  • Zod schema for input validation of w3_coupon_create tool arguments. Requires a single 'claimCode' string parameter.
    export const W3CouponCreateArgsSchema = z
      .object({
        claimCode: z.string().describe("The claim code for the coupon."),
      })
      .describe("Attempts to create/claim a coupon using a claim code.");
  • Maps the tool name 'w3_coupon_create' to its handler function in the exported toolHandlers object.
    w3_coupon_create: handleW3CouponCreate,

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/alexbakers/mcp-ipfs'

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