Skip to main content
Glama

manage_product

Create, update, or delete digital products on the402.ai marketplace. Manage one-time purchasable files, datasets, and templates as a provider using API authentication.

Instructions

Create, update, or delete a digital product on the402.ai as a provider. Products are one-time purchasable digital goods (files, datasets, templates). Requires API key (provider account).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYescreate = new product, update = modify existing, delete = remove
product_idNoProduct ID (required for update/delete)
nameNoProduct name (required for create)
descriptionNoProduct description (required for create)
priceNoPrice in USD (required for create)
categoryNoProduct category

Implementation Reference

  • The `manage_product` tool handles create, update, and delete actions for digital products by calling the appropriate client auth methods.
    server.tool(
    	"manage_product",
    	"Create, update, or delete a digital product on the402.ai as a provider. Products are one-time purchasable digital goods (files, datasets, templates). Requires API key (provider account).",
    	{
    		action: z
    			.enum(["create", "update", "delete"])
    			.describe(
    				"create = new product, update = modify existing, delete = remove"
    			),
    		product_id: z
    			.string()
    			.optional()
    			.describe("Product ID (required for update/delete)"),
    		name: z
    			.string()
    			.optional()
    			.describe("Product name (required for create)"),
    		description: z
    			.string()
    			.optional()
    			.describe("Product description (required for create)"),
    		price: z
    			.string()
    			.optional()
    			.describe("Price in USD (required for create)"),
    		category: z.string().optional().describe("Product category"),
    	},
    	async ({ action, product_id, name, description, price, category }) => {
    		if (action === "delete") {
    			if (!product_id) throw new Error("product_id is required for delete");
    			const result = await client.authDelete(`/v1/products/${product_id}`);
    			return {
    				content: [
    					{ type: "text" as const, text: JSON.stringify(result, null, 2) },
    				],
    			};
    		}
    
    		if (action === "update") {
    			if (!product_id) throw new Error("product_id is required for update");
    			const body: Record<string, unknown> = {};
    			if (name) body.name = name;
    			if (description) body.description = description;
    			if (price) body.price = price;
    			if (category) body.category = category;
    			const result = await client.authPut(`/v1/products/${product_id}`, body);
    			return {
    				content: [
    					{ type: "text" as const, text: JSON.stringify(result, null, 2) },
    				],
    			};
    		}
    
    		// create
    		if (!name || !description || !price)
    			throw new Error(
    				"name, description, and price are required to create a product"
    			);
    		const body: Record<string, unknown> = { name, description, price };
    		if (category) body.category = category;
    
    		// Note: file upload requires multipart — for CLI creation, product metadata only.
    		// File can be uploaded separately via the dashboard.
    		const result = await client.authPost("/v1/products", body);
    		return {
    			content: [
    				{ type: "text" as const, text: JSON.stringify(result, null, 2) },
    			],
    		};
    	}
    );

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/the402ai/mcp-server'

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