upload
Update an existing Chrome Web Store item draft by providing a ZIP file. This revises your extension or theme before publishing.
Instructions
Upload a ZIP file to update an existing Chrome Web Store item draft. Note: Creating new items via API is not supported in v2 — use the Developer Dashboard to create new items.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| zipPath | Yes | Absolute path to the ZIP file to upload | |
| itemId | No | Extension item ID (defaults to CWS_ITEM_ID env var) | |
| publisherId | No | Publisher ID (defaults to CWS_PUBLISHER_ID env var or 'me') |
Implementation Reference
- src/index.ts:240-276 (registration)Registers the 'upload' tool on the MCP server with schema (zipPath required, itemId optional, publisherId optional) and handler that reads the ZIP file and calls the Chrome Web Store upload API.
server.tool( "upload", "Upload a ZIP file to update an existing Chrome Web Store item draft. Note: Creating new items via API is not supported in v2 — use the Developer Dashboard to create new items.", { zipPath: z.string().describe("Absolute path to the ZIP file to upload"), itemId: z .string() .optional() .describe("Extension item ID (defaults to CWS_ITEM_ID env var)"), publisherId: z .string() .optional() .describe("Publisher ID (defaults to CWS_PUBLISHER_ID env var or 'me')"), }, async ({ zipPath, itemId, publisherId }) => { try { const id = resolveItemId(itemId); const pub = resolvePublisherId(publisherId); const zipData = readFileSync(zipPath); const url = `${UPLOAD_BASE}/publishers/${pub}/items/${id}:upload`; const result = await apiCall(url, { method: "POST", headers: { "Content-Type": "application/zip" }, body: zipData, }); return formatResponse(result); } catch (e: any) { return { content: [{ type: "text" as const, text: `Error: ${e.message}` }], isError: true, }; } }, ); - src/index.ts:244-253 (schema)Input schema for the upload tool: zipPath (required string), itemId (optional string), publisherId (optional string).
zipPath: z.string().describe("Absolute path to the ZIP file to upload"), itemId: z .string() .optional() .describe("Extension item ID (defaults to CWS_ITEM_ID env var)"), publisherId: z .string() .optional() .describe("Publisher ID (defaults to CWS_PUBLISHER_ID env var or 'me')"), }, - src/index.ts:254-275 (handler)Handler function for the 'upload' tool. Resolves itemId and publisherId, reads the ZIP file, sends a POST request to the Chrome Web Store upload API endpoint, and returns the formatted API response.
async ({ zipPath, itemId, publisherId }) => { try { const id = resolveItemId(itemId); const pub = resolvePublisherId(publisherId); const zipData = readFileSync(zipPath); const url = `${UPLOAD_BASE}/publishers/${pub}/items/${id}:upload`; const result = await apiCall(url, { method: "POST", headers: { "Content-Type": "application/zip" }, body: zipData, }); return formatResponse(result); } catch (e: any) { return { content: [{ type: "text" as const, text: `Error: ${e.message}` }], isError: true, }; } }, - src/index.ts:28-28 (helper)Constant UPLOAD_BASE defining the base URL for the Chrome Web Store upload API (https://chromewebstore.googleapis.com/upload/v2).
const UPLOAD_BASE = "https://chromewebstore.googleapis.com/upload/v2"; - src/index.ts:873-877 (registration)Sandbox registration of the 'upload' tool (a stub with noop handler) for the Smithery sandbox export.
sandbox.tool("upload", "Upload a ZIP file to update an existing Chrome Web Store item draft.", { zipPath: z.string().describe("Absolute path to the ZIP file to upload"), itemId: z.string().optional().describe("Extension item ID"), publisherId: z.string().optional().describe("Publisher ID"), }, noop);