Skip to main content
Glama

updateProject

Modify an existing DeepWriter project by updating fields such as title, author, prompts, AI model, and stylistic details using the provided project ID and API key.

Instructions

Update an existing project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyYesThe DeepWriter API key for authentication.
project_idYesThe ID of the project to update.
updatesYesObject containing fields to update.

Implementation Reference

  • Core handler for the 'updateProject' MCP tool: validates inputs (project_id, updates), retrieves API key from env, calls deepwriterClient.updateProject API, formats success/error into MCP content structure.
    export const updateProjectTool = {
      name: "updateProject",
      description: "Update an existing project",
      // TODO: Add input/output schema validation if needed
      async execute(args: UpdateProjectInputArgs): Promise<UpdateProjectMcpOutput> {
        console.error(`Executing updateProject 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");
        }
        if (!args.updates || Object.keys(args.updates).length === 0) {
          throw new Error("Missing required argument: updates (must be a non-empty object)");
        }
    
        try {
          // Call the actual API client function
          // Note: The API client expects ProjectUpdates type, which matches ProjectUpdatesArgs here
          const apiResponse = await apiClient.updateProject(apiKey, args.project_id, args.updates);
          console.error(`API call successful for updateProject. Updated project ID: ${apiResponse.id}`);
    
          // Transform the API response into MCP format
          const mcpResponse: UpdateProjectMcpOutput = {
            content: [
              { type: 'text', text: `Successfully updated project with ID: ${apiResponse.id}` }
            ]
          };
    
          return mcpResponse; // Return the MCP-compliant structure
        } catch (error) {
          console.error(`Error executing updateProject tool: ${error}`);
          // Format error for MCP response
          const errorMessage = error instanceof Error ? error.message : String(error);
          throw new Error(`Failed to update project ID ${args.project_id}: ${errorMessage}`);
        }
      }
    };
  • src/index.ts:256-290 (registration)
    MCP server registration of 'updateProject' tool: defines inline Zod input schema, provides wrapper async handler that logs invocation and delegates execution to updateProjectTool.execute, adds tool annotations.
    server.tool(
      updateProjectTool.name,
      updateProjectTool.description,
      {
        project_id: z.string().describe("The ID of the project to update."),
        updates: z.object({
          author: z.string().optional().describe("Author of the work"),
          email: z.string().email().optional().describe("Email associated with the project"),
          model: z.string().optional().describe("AI model used"),
          outline_text: z.string().optional().describe("Outline text"),
          prompt: z.string().optional().describe("Main prompt for generation"),
          style_text: z.string().optional().describe("Stylistic guidance text"),
          supplemental_info: z.string().optional().describe("Supplemental information"),
          title: z.string().optional().describe("New title for the project"),
          work_description: z.string().optional().describe("Description of the work"),
          work_details: z.string().optional().describe("Detailed information about the work"),
          work_vision: z.string().optional().describe("Vision for the work")
        }).describe("Object containing fields to update.")
      },
      async ({ project_id, updates }: UpdateProjectParams) => {
        console.error(`SDK invoking ${updateProjectTool.name}...`);
        const result = await updateProjectTool.execute({ project_id, updates });
        return {
          content: result.content,
          annotations: {
            title: "Update Project",
            readOnlyHint: false,
            destructiveHint: false, // Modifies but doesn't destroy
            idempotentHint: true, // Same updates produce same result
            openWorldHint: false
          }
        };
      }
    );
  • Zod schema definitions for updateProject tool inputs: projectUpdatesSchema for the nested 'updates' object and updateProjectInputSchema combining project_id with updates (note: defined but not directly used in registration).
    const projectUpdatesSchema = z.object({
        author: z.string().optional().describe("Author of the work"),
        email: z.string().email().optional().describe("Email associated with the project"),
        model: z.string().optional().describe("AI model used"),
        outline_text: z.string().optional().describe("Outline text"),
        prompt: z.string().optional().describe("Main prompt for generation"),
        style_text: z.string().optional().describe("Stylistic guidance text"),
        supplemental_info: z.string().optional().describe("Supplemental information"),
        title: z.string().optional().describe("New title for the project"),
        work_description: z.string().optional().describe("Description of the work"),
        work_details: z.string().optional().describe("Detailed information about the work"),
        work_vision: z.string().optional().describe("Vision for the work")
    }).describe("Object containing fields to update.");
    
    const updateProjectInputSchema = z.object({
      project_id: z.string().describe("The ID of the project to update."),
      updates: projectUpdatesSchema // Use the nested schema for updates
    });
  • Helper function in API client that performs the actual PATCH request to DeepWriter /api/updateProject endpoint, including input validation and using makeApiRequest utility.
    export async function updateProject(
      apiKey: string,
      projectId: string,
      updates: ProjectUpdates
    ): Promise<UpdateProjectResponse> {
      console.error(`Calling actual updateProject API for project ID: ${projectId}`);
      if (!apiKey) {
        throw new Error("API key is required for updateProject");
      }
      if (!projectId) {
        throw new Error("Project ID is required for updateProject");
      }
      if (!updates || Object.keys(updates).length === 0) {
        throw new Error("Updates object cannot be empty for updateProject");
      }
    
      const endpoint = `/api/updateProject?projectId=${encodeURIComponent(projectId)}`;
      return makeApiRequest<UpdateProjectResponse>(endpoint, apiKey, 'PATCH', updates);
    }
  • TypeScript interfaces defining input args for updateProject tool handler (ProjectUpdatesArgs matching API, UpdateProjectInputArgs for execute function).
    interface ProjectUpdatesArgs {
      author?: string;
      email?: string;
      model?: string;
      outline_text?: string;
      prompt?: string;
      style_text?: string;
      supplemental_info?: string;
      title?: string;
      work_description?: string;
      work_details?: string;
      work_vision?: string;
    }
    
    interface UpdateProjectInputArgs {
      project_id: string;
      updates: ProjectUpdatesArgs;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Update an existing project' implies a mutation operation but doesn't specify permissions required, whether changes are reversible, rate limits, or what happens to fields not included in updates. This leaves significant gaps for an agent to understand the tool's behavior.

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 a single, efficient sentence with zero wasted words. It's appropriately front-loaded with the core action and resource, making it easy to parse quickly.

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?

For a mutation tool with 3 parameters, no annotations, no output schema, and multiple sibling tools, the description is inadequate. It doesn't explain what the tool returns, how updates are applied, or provide context about when this tool is appropriate versus alternatives. The high schema coverage helps but doesn't compensate for missing behavioral and usage context.

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%, so the schema fully documents all 3 parameters (api_key, project_id, updates) and their nested properties. The description adds no additional parameter semantics beyond what's in the schema, meeting the baseline for high schema coverage.

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 'Update an existing project' clearly states the action (update) and resource (project), but it's vague about what aspects can be updated and doesn't differentiate from sibling tools like createProject or deleteProject. It provides basic purpose but lacks specificity about scope.

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?

No guidance is provided on when to use this tool versus alternatives like createProject or deleteProject. The description doesn't mention prerequisites (e.g., needing an existing project ID) or contextual factors that would inform tool selection among siblings.

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