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
| Name | Required | Description | Default |
|---|---|---|---|
| claimCode | Yes | The claim code for the coupon. |
Implementation Reference
- src/tool_handlers.ts:750-769 (handler)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(), }), }, ], }; };
- src/schemas.ts:316-320 (schema)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.");
- src/tool_handlers.ts:972-972 (registration)Maps the tool name 'w3_coupon_create' to its handler function in the exported toolHandlers object.w3_coupon_create: handleW3CouponCreate,