manage_plan
Modify or remove subscription plans on the402.ai marketplace. Requires plan owner authentication to update details or delete plans.
Instructions
Update or delete a subscription plan on the402.ai. Only the provider who created the plan can modify it. Requires API key (plan owner).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| plan_id | Yes | The plan ID | |
| action | Yes | update = modify plan details, delete = remove plan | |
| name | No | New plan name (for update) | |
| description | No | New description (for update) | |
| price | No | New price (for update) |
Implementation Reference
- src/tools/subscriptions.ts:107-144 (handler)The implementation of the 'manage_plan' tool, which handles updating or deleting subscription plans.
server.tool( "manage_plan", "Update or delete a subscription plan on the402.ai. Only the provider who created the plan can modify it. Requires API key (plan owner).", { plan_id: z.string().describe("The plan ID"), action: z .enum(["update", "delete"]) .describe("update = modify plan details, delete = remove plan"), name: z.string().optional().describe("New plan name (for update)"), description: z .string() .optional() .describe("New description (for update)"), price: z.string().optional().describe("New price (for update)"), }, async ({ plan_id, action, name, description, price }) => { if (action === "delete") { const result = await client.authDelete(`/v1/plans/${plan_id}`); return { content: [ { type: "text" as const, text: JSON.stringify(result, null, 2) }, ], }; } const body: Record<string, unknown> = {}; if (name) body.name = name; if (description) body.description = description; if (price) body.price = price; const result = await client.authPut(`/v1/plans/${plan_id}`, body); return { content: [ { type: "text" as const, text: JSON.stringify(result, null, 2) }, ], }; } );