create_project
Initiate and manage new projects on the Memory Bank MCP Server by defining project names and descriptions, enabling organized multi-project Markdown document handling and LLM tool integration.
Instructions
创建新项目
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | 项目描述 | |
| name | Yes | 项目名称 |
Implementation Reference
- src/mcp/tools.ts:30-61 (handler)Core handler function implementing the create_project tool logic. Validates input, creates project via storage, initializes default documents from config templates, and returns project details.export const createProject = async (name: string, description: string) => { try { if (!name) throw new Error('项目名称不能为空'); const project = await projectStorage.create(name, description); // 为新项目创建默认文档 const defaultDocs = []; for (const [type, template] of Object.entries(config.defaultDocumentTemplates)) { const docName = Document.getFileName(type); const doc = await documentStorage.create( project.id, docName, template, type ); defaultDocs.push(doc); } return { id: project.id, name: project.name, description: project.description, createdAt: project.createdAt, updatedAt: project.updatedAt, documents: defaultDocs.map(d => d.name) }; } catch (error) { console.error('创建项目错误:', error); throw new Error('创建项目失败'); } };
- src/mcp/server.ts:65-81 (registration)Tool registration in MCP server's listTools response, including name, description, and input schema definition.name: 'create_project', description: '创建新项目', inputSchema: { type: 'object', properties: { name: { type: 'string', description: '项目名称', }, description: { type: 'string', description: '项目描述', }, }, required: ['name'], }, },
- src/mcp/server.ts:642-650 (handler)Server-side dispatch handler for create_project tool calls, validates arguments and invokes the tools.createProject function.case 'create_project': { if (!args.name) { throw new McpError(ErrorCode.InvalidParams, '项目名称不能为空'); } return this.formatResponse(await tools.createProject( args.name as string, (args.description as string) || '' )); }