Skip to main content
Glama

update_project

Modify project details such as name and description to reflect evolving requirements. Ensure project documentation remains accurate and up-to-date by specifying the working directory and unique project ID.

Instructions

Evolve and refine your project information as requirements change and scope develops. Maintain accurate project documentation with flexible updates to names and descriptions, ensuring your project data stays current and meaningful throughout the development lifecycle.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoNew description for the project (optional)
idYesThe unique identifier of the project to update
nameNoNew name for the project (optional)
workingDirectoryYesThe full absolute path to the working directory where data is stored. MUST be an absolute path, never relative. Windows: "C:\Users\username\project" or "D:\projects\my-app". Unix/Linux/macOS: "/home/username/project" or "/Users/username/project". Do NOT use: ".", "..", "~", "./folder", "../folder" or any relative paths. Ensure the path exists and is accessible before calling this tool. NOTE: When server is started with --claude flag, this parameter is ignored and a global user directory is used instead.

Implementation Reference

  • The asynchronous handler function that implements the core logic of the 'update_project' tool. It performs input validation, checks project existence and name uniqueness, calls storage.updateProject, and returns formatted success or error responses.
    handler: async ({ id, name, description }: { id: string; name?: string; description?: string }) => { try { // Validate inputs if (!id || id.trim().length === 0) { return { content: [{ type: 'text' as const, text: 'Error: Project ID is required.' }], isError: true }; } if (name !== undefined && (!name || name.trim().length === 0)) { return { content: [{ type: 'text' as const, text: 'Error: Project name must not be empty.' }], isError: true }; } if (name !== undefined && name.trim().length > 100) { return { content: [{ type: 'text' as const, text: 'Error: Project name must be 100 characters or less.' }], isError: true }; } if (description !== undefined && (!description || description.trim().length === 0)) { return { content: [{ type: 'text' as const, text: 'Error: Project description must not be empty.' }], isError: true }; } if (description !== undefined && description.trim().length > 1000) { return { content: [{ type: 'text' as const, text: 'Error: Project description must be 1000 characters or less.' }], isError: true }; } if (name === undefined && description === undefined) { return { content: [{ type: 'text' as const, text: 'Error: At least one field (name or description) must be provided for update.' }], isError: true }; } const existingProject = await storage.getProject(id.trim()); if (!existingProject) { return { content: [{ type: 'text' as const, text: `Error: Project with ID "${id}" not found. Use list_projects to see all available projects.` }], isError: true }; } // Check for name uniqueness if name is being updated if (name && name.toLowerCase() !== existingProject.name.toLowerCase()) { const existingProjects = await storage.getProjects(); const nameExists = existingProjects.some(p => p.id !== id && p.name.toLowerCase() === name.toLowerCase()); if (nameExists) { return { content: [{ type: 'text' as const, text: `Error: A project with the name "${name}" already exists. Please choose a different name.` }], isError: true }; } } const updates: any = { updatedAt: new Date().toISOString() }; if (name !== undefined) { updates.name = name.trim(); } if (description !== undefined) { updates.description = description.trim(); } const updatedProject = await storage.updateProject(id, updates); if (!updatedProject) { return { content: [{ type: 'text' as const, text: `Error: Failed to update project with ID "${id}".` }], isError: true }; } const changedFields = []; if (name !== undefined) changedFields.push('name'); if (description !== undefined) changedFields.push('description'); return { content: [{ type: 'text' as const, text: `✅ Project updated successfully! **${updatedProject.name}** (ID: ${updatedProject.id}) Description: ${updatedProject.description} Last Updated: ${new Date(updatedProject.updatedAt).toLocaleString()} Updated fields: ${changedFields.join(', ')}` }] }; } catch (error) { return { content: [{ type: 'text' as const, text: `Error updating project: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true }; } }
  • Zod inputSchema definition for the update_project tool, validating id (required string), name (optional string), and description (optional string).
    inputSchema: { id: z.string(), name: z.string().optional(), description: z.string().optional() },
  • createUpdateProjectTool function that constructs and exports the complete tool definition (name, description, schema, handler) for registration in the MCP server.
    export function createUpdateProjectTool(storage: Storage) { return { name: 'update_project', description: 'Update the name and/or description of an existing project', inputSchema: { id: z.string(), name: z.string().optional(), description: z.string().optional() }, handler: async ({ id, name, description }: { id: string; name?: string; description?: string }) => { try { // Validate inputs if (!id || id.trim().length === 0) { return { content: [{ type: 'text' as const, text: 'Error: Project ID is required.' }], isError: true }; } if (name !== undefined && (!name || name.trim().length === 0)) { return { content: [{ type: 'text' as const, text: 'Error: Project name must not be empty.' }], isError: true }; } if (name !== undefined && name.trim().length > 100) { return { content: [{ type: 'text' as const, text: 'Error: Project name must be 100 characters or less.' }], isError: true }; } if (description !== undefined && (!description || description.trim().length === 0)) { return { content: [{ type: 'text' as const, text: 'Error: Project description must not be empty.' }], isError: true }; } if (description !== undefined && description.trim().length > 1000) { return { content: [{ type: 'text' as const, text: 'Error: Project description must be 1000 characters or less.' }], isError: true }; } if (name === undefined && description === undefined) { return { content: [{ type: 'text' as const, text: 'Error: At least one field (name or description) must be provided for update.' }], isError: true }; } const existingProject = await storage.getProject(id.trim()); if (!existingProject) { return { content: [{ type: 'text' as const, text: `Error: Project with ID "${id}" not found. Use list_projects to see all available projects.` }], isError: true }; } // Check for name uniqueness if name is being updated if (name && name.toLowerCase() !== existingProject.name.toLowerCase()) { const existingProjects = await storage.getProjects(); const nameExists = existingProjects.some(p => p.id !== id && p.name.toLowerCase() === name.toLowerCase()); if (nameExists) { return { content: [{ type: 'text' as const, text: `Error: A project with the name "${name}" already exists. Please choose a different name.` }], isError: true }; } } const updates: any = { updatedAt: new Date().toISOString() }; if (name !== undefined) { updates.name = name.trim(); } if (description !== undefined) { updates.description = description.trim(); } const updatedProject = await storage.updateProject(id, updates); if (!updatedProject) { return { content: [{ type: 'text' as const, text: `Error: Failed to update project with ID "${id}".` }], isError: true }; } const changedFields = []; if (name !== undefined) changedFields.push('name'); if (description !== undefined) changedFields.push('description'); return { content: [{ type: 'text' as const, text: `✅ Project updated successfully! **${updatedProject.name}** (ID: ${updatedProject.id}) Description: ${updatedProject.description} Last Updated: ${new Date(updatedProject.updatedAt).toLocaleString()} Updated fields: ${changedFields.join(', ')}` }] }; } catch (error) { return { content: [{ type: 'text' as const, text: `Error updating project: ${error instanceof Error ? error.message : 'Unknown error'}` }], isError: true }; } } }; }
  • TypeScript interface defining UpdateProjectInput with optional name and description fields, used in storage layer.
    export interface UpdateProjectInput { /** Project name (optional) */ name?: string; /** Project description/overview (optional) */ description?: string; }
  • File-based storage implementation of updateProject method, which updates the project record in memory and persists to JSON file.
    async updateProject(id: string, updates: Partial<Project>): Promise<Project | null> { const index = this.data.projects.findIndex(p => p.id === id); if (index === -1) return null; this.data.projects[index] = { ...this.data.projects[index], ...updates }; await this.save(); return this.data.projects[index]; }

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/Pimzino/agentic-tools-mcp'

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