yuque_create_repo
Create a knowledge repository on the Yuque platform by specifying name, description, and visibility settings to organize and manage documentation.
Instructions
创建知识库 (Create knowledge repository)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | 知识库名称 (Repository name) | |
| description | No | 知识库描述,可选 (Repository description, optional) | |
| isPublic | No | 是否公开,默认false (Whether public, default false) |
Implementation Reference
- src/tools/handlers.ts:242-263 (handler)The handler function that executes the yuque_create_repo tool logic, calling YuqueClient.createRepo and returning the result as JSON content.async function handleCreateRepo( client: YuqueClient, args: { name: string; description?: string; isPublic?: boolean; } ) { const repo = await client.createRepo( args.name, args.description, args.isPublic || false ); return { content: [ { type: 'text', text: JSON.stringify(repo, null, 2), }, ], }; }
- src/tools/definitions.ts:177-201 (schema)The schema definition for the yuque_create_repo tool, including input parameters validation and description.{ name: 'yuque_create_repo', description: '创建知识库 (Create knowledge repository)', inputSchema: { type: 'object', properties: { name: { type: 'string', description: '知识库名称 (Repository name)', minLength: 1, maxLength: 100, }, description: { type: 'string', description: '知识库描述,可选 (Repository description, optional)', maxLength: 500, }, isPublic: { type: 'boolean', description: '是否公开,默认false (Whether public, default false)', }, }, required: ['name'], }, },
- src/server.ts:46-50 (registration)Tool registration point where all YUQUE_TOOLS (including yuque_create_repo) are provided to the MCP server via ListToolsRequestHandler.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: YUQUE_TOOLS, }; });
- src/yuque-client.ts:253-274 (helper)Supporting utility in YuqueClient that performs the actual API call to create a repository, used by the tool handler.async createRepo( name: string, description?: string, isPublic: boolean = false ): Promise<YuqueRepo> { const slug = this.generateSlug(name); // Get current user ID for repository creation const user = await this.getUser(); const userId = user.id; return this.request<YuqueRepo>(`/users/${userId}/repos`, { method: 'POST', data: { name, slug, description: description || '', public: isPublic ? 1 : 0, type: 'Book', }, }); }