Skip to main content
Glama
sweetwisdom

MCP Project Query Server

by sweetwisdom

add_project

Add new projects to the MCP Project Query Server by providing name, description, start date, investment amount, and progress details.

Instructions

新增项目

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYes

Implementation Reference

  • Registration of the 'add_project' MCP tool, including input schema (zod) and 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); } );
  • Input schema for add_project tool using zod
    { project: z.object({ name: z.string().describe('项目名称'), description: z.string().describe('项目描述'), startDate: z.string().describe('开始日期'), investment: z.number().describe('投资金额'), progress: z.number().describe('当前进度'), }), },
  • Handler in ProjectController that calls service to add project and returns formatted success/error response
    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 : '未知错误'}`, }, ], }; } }
  • ProjectService.addProject: adds project via repository and saves changes
    async addProject(project: Project): Promise<void> { this.projectRepository.addProject(project); await this.projectRepository.saveProjects(); }
  • Repository method that appends the project to the in-memory array
    addProject(project: any): void { this.projects.push(project); }

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