delete_portal
Delete a portal permanently by providing its ID. This action cannot be undone; uploaded packages remain accessible. Must have MASV_ALLOW_DELETE=true set.
Instructions
Delete a portal by ID. This permanently removes the portal and cannot be undone. Packages that were uploaded to this portal will remain accessible. Requires MASV_ALLOW_DELETE=true environment variable to be set.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| portalId | Yes | Id of the portal to delete |
Implementation Reference
- src/api/portals.ts:229-249 (handler)The main handler function for deleting a portal. Checks MASV_ALLOW_DELETE env var, then makes a DELETE request to the MASV API. Returns success on 204 status, otherwise parses error response.
async function deletePortal({ portalId }: DeletePortalParams) { if (!MASV_ALLOW_DELETE) { throw new Error("Delete operations are not allowed. Set MASV_ALLOW_DELETE=true in environment variables to enable."); } const url = new URL(`${MASV_BASE_URL}/v1/portals/${portalId}`); const headers = { "content-type": "application/json", "x-api-key": MASV_API_KEY, }; const r = await fetch(url.toString(), { method: "DELETE", headers }); if (r.status === 204) { return { success: true, message: "Portal deleted successfully" }; } const data = await r.json(); return data; } - src/api/portals.ts:223-225 (schema)Zod schema for the delete_portal tool input, defining a required 'portalId' string parameter.
const DeletePortalSchema = z.object({ portalId: z.string().describe("Id of the portal to delete"), }); - src/index.ts:388-404 (registration)Registration of the 'delete_portal' tool with the MCP server, including description, input schema (from DeletePortalSchema.shape), and handler that calls deletePortal().
server.registerTool( "delete_portal", { description: "Delete a portal by ID. This permanently removes the portal and cannot be undone. Packages that were uploaded to this portal will remain accessible. Requires MASV_ALLOW_DELETE=true environment variable to be set.", inputSchema: DeletePortalSchema.shape, }, async (args) => { try { const data = await deletePortal(args); return mcpOk(data); } catch (error) { return mcpError(error); } }, ); - src/index.ts:47-48 (helper)Import statement for DeletePortalSchema and deletePortal from ./api/portals.js.
DeletePortalSchema, deletePortal,