archive_project
Archive a project and permanently remove it from local storage. This action cannot be undone.
Instructions
Archive a project and remove it from the local key store. This action cannot be undone.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | The project ID to archive |
Implementation Reference
- src/tools/archive-project.ts:10-38 (handler)The main handler function that archives a project by making a DELETE API request and removing it from the local keystore
export async function handleArchiveProject(args: { project_id: string; }): Promise<{ content: Array<{ type: "text"; text: string }>; isError?: boolean }> { const project = getProject(args.project_id); if (!project) return projectNotFound(args.project_id); const res = await apiRequest(`/v1/projects/${args.project_id}`, { method: "DELETE", headers: { Authorization: `Bearer ${project.service_key}`, }, }); if (!res.ok) return formatApiError(res, "archiving project"); // Remove from local key store const store = loadKeyStore(); delete store.projects[args.project_id]; saveKeyStore(store); return { content: [ { type: "text", text: `Project \`${args.project_id}\` archived and removed from local key store.`, }, ], }; } - src/tools/archive-project.ts:6-8 (schema)Input schema definition using Zod that validates the project_id parameter
export const archiveProjectSchema = { project_id: z.string().describe("The project ID to archive"), }; - src/index.ts:280-285 (registration)Registration of the archive_project tool with the MCP server, including its name, description, schema, and handler
server.tool( "archive_project", "Archive a project and remove it from the local key store. This action cannot be undone.", archiveProjectSchema, async (args) => handleArchiveProject(args), ); - src/keystore.ts:42-48 (helper)getProject helper function that retrieves project data from the local keystore by project ID
export function getProject( projectId: string, path?: string, ): StoredProject | undefined { const store = loadKeyStore(path); return store.projects[projectId]; } - src/errors.ts:90-102 (helper)projectNotFound helper function that returns a consistent error when a project is not in the keystore
export function projectNotFound(projectId: string): ToolResult { return { content: [ { type: "text", text: `Error: Project \`${projectId}\` not found in key store. ` + `Use \`provision_postgres_project\` to create a project first.`, }, ], isError: true, }; }