Skip to main content
Glama

deleteProject

Remove a specific project from the DeepWriter MCP Server by providing the project ID and API key for secure deletion.

Instructions

Delete a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyYesThe DeepWriter API key for authentication.
project_idYesThe ID of the project to delete.

Implementation Reference

  • The primary handler for the 'deleteProject' MCP tool. This function executes the tool logic: validates inputs, retrieves API key from env, calls the DeepWriter API client to delete the project, transforms the response to MCP format, and handles errors.
    export const deleteProjectTool = {
      name: "deleteProject",
      description: "Delete a project",
      // TODO: Add input/output schema validation if needed
      async execute(args: DeleteProjectInputArgs): Promise<DeleteProjectMcpOutput> {
        console.error(`Executing deleteProject tool for project ID: ${args.project_id}...`);
    
        // Get API key from environment
        const apiKey = process.env.DEEPWRITER_API_KEY;
        if (!apiKey) {
          throw new Error("DEEPWRITER_API_KEY environment variable is required");
        }
        if (!args.project_id) {
          throw new Error("Missing required argument: project_id");
        }
    
        try {
          // Call the actual API client function
          const apiResponse = await apiClient.deleteProject(apiKey, args.project_id);
          console.error(`API call successful for deleteProject.`);
    
          // Transform the API response into MCP format
          const mcpResponse: DeleteProjectMcpOutput = {
            content: [
              // Use the message from the API response
              { type: 'text', text: apiResponse.message }
            ]
          };
    
          return mcpResponse; // Return the MCP-compliant structure
        } catch (error) {
          console.error(`Error executing deleteProject tool: ${error}`);
          // Format error for MCP response
          const errorMessage = error instanceof Error ? error.message : String(error);
          throw new Error(`Failed to delete project ID ${args.project_id}: ${errorMessage}`);
        }
      }
    };
  • src/index.ts:291-310 (registration)
    Registration of the deleteProject tool with the MCP server. Wraps the tool's execute function, provides Zod input schema validation, and adds annotations indicating it's destructive.
    server.tool(
      deleteProjectTool.name,
      deleteProjectTool.description,
      {
        project_id: z.string().describe("The ID of the project to delete.")
      },
      async ({ project_id }: DeleteProjectParams) => {
        console.error(`SDK invoking ${deleteProjectTool.name}...`);
        const result = await deleteProjectTool.execute({ project_id });
        return {
          content: result.content,
          annotations: {
            title: "Delete Project",
            readOnlyHint: false,
            destructiveHint: true, // This is a destructive operation
            idempotentHint: true, // Deleting already deleted project is safe
            openWorldHint: false
          }
        };
      }
  • TypeScript interfaces defining the input arguments and MCP output structure for the deleteProject tool.
    interface DeleteProjectInputArgs {
      project_id: string;
    }
    
    // Define the MCP-compliant output structure
    interface DeleteProjectMcpOutput {
      content: { type: 'text'; text: string }[];
    }
  • Zod schema for input validation of deleteProject tool parameters, used during MCP server registration.
    const deleteProjectInputSchema = z.object({
      project_id: z.string().describe("The ID of the project to delete.")
    });
  • Helper function in the API client that performs the actual HTTP DELETE request to the DeepWriter API endpoint for deleting a project, including response handling for 204 No Content.
    export interface DeleteProjectResponse {
      message: string; // Success message
    }
    
    export async function deleteProject(apiKey: string, projectId: string): Promise<DeleteProjectResponse> {
      console.error(`Calling actual deleteProject API for project ID: ${projectId}`);
      if (!apiKey) {
        throw new Error("API key is required for deleteProject");
      }
      if (!projectId) {
        throw new Error("Project ID is required for deleteProject");
      }
    
      const endpoint = `/api/deleteProject?projectId=${encodeURIComponent(projectId)}`;
      // Use a temporary type that allows for an empty object from makeApiRequest on 204
      type TempDeleteResponse = DeleteProjectResponse | {};
      const response = await makeApiRequest<TempDeleteResponse>(endpoint, apiKey, 'DELETE');
    
      // If API returns 204 (empty object), construct the standard success message
      if (typeof response === 'object' && Object.keys(response).length === 0) {
          return { message: `Project ${projectId} deleted successfully.` };
      }
      // Otherwise, assume the API returned the expected { message: ... } structure
      return response as DeleteProjectResponse;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. 'Delete a project' implies a destructive, irreversible mutation, but it doesn't specify authentication needs (implied by api_key param), rate limits, error conditions, or what happens upon success (e.g., confirmation message). For a destructive tool, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with zero wasted words—'Delete a project' is a clear, front-loaded statement. Every word earns its place, making it efficient for quick understanding, though this conciseness comes at the cost of detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (destructive mutation with no annotations and no output schema), the description is incomplete. It doesn't cover behavioral aspects like irreversibility, authentication requirements, or response format, leaving gaps that could hinder correct agent usage in a context with siblings like 'updateProject'.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear descriptions for both parameters (api_key for authentication, project_id for identification). The description adds no additional meaning beyond the schema, but since the schema is comprehensive, a baseline score of 3 is appropriate as it doesn't detract value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Delete a project' clearly states the verb (delete) and resource (project), making the basic purpose understandable. However, it lacks specificity about what 'project' means in this context and doesn't differentiate from sibling tools like 'updateProject' or 'getProjectDetails' beyond the obvious action difference. It's adequate but minimal.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., project must exist), consequences (e.g., irreversible deletion), or when to choose deletion over other operations like updating. With siblings like 'updateProject' and 'deleteProject' available, this gap is significant.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/deepwriter-ai/Deepwriter-MCP'

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