Skip to main content
Glama

add_project

Add a new project with details including name, description, start date, investment amount, and current progress to the project management system.

Instructions

新增项目

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYes

Implementation Reference

  • Registers the MCP tool 'add_project' with description, Zod input schema for project details, and a handler that delegates to ProjectController.addProject
    server.tool( 'add_project', '新增项目', { project: z.object({ name: z.string().describe('项目名称'), description: z.string().describe('项目描述'), startDate: z.string().describe('开始日期'), investment: z.number().describe('投资金额'), progress: z.number().describe('当前进度'), }), }, async ({ project }) => { return await projectController.addProject(project); } );
  • Handler function that executes the core logic for adding a project: invokes the service, formats success/error response in MCP content format.
    async addProject(project: Project): Promise<{ content: Array<{ type: "text"; text: string }> }> { try { await this.projectService.addProject(project); return { content: [ { type: 'text', text: `新增项目成功: ${JSON.stringify(project)}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `新增项目失败: ${error instanceof Error ? error.message : '未知错误'}`, }, ], }; } }
  • Service layer helper that adds the project to the repository and persists the changes.
    async addProject(project: Project): Promise<void> { this.projectRepository.addProject(project); await this.projectRepository.saveProjects(); }
  • Repository method that appends the new project to the in-memory array of projects.
    addProject(project: any): void { this.projects.push(project); }
  • TypeScript interface defining the Project structure, matching the tool input schema.
    export interface Project { name: string; description: string; startDate: string; investment: number; progress: number; }

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/sweetwisdom/mcp-demo'

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