Skip to main content
Glama

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
NameRequiredDescriptionDefault
project_idYesThe project ID to archive

Implementation Reference

  • 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.`,
          },
        ],
      };
    }
  • 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),
    );
  • 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];
    }
  • 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,
      };
    }

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/kychee-com/run402'

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