Skip to main content
Glama
ispyridis

Calibre RAG MCP Server

by ispyridis

create_project

Initialize a new vector-based RAG project for semantic search and contextual conversations within your Calibre ebook library, organizing books for enhanced content retrieval.

Instructions

Create a new RAG project for vector-based book search

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoProject description
nameYesProject name (alphanumeric and underscores only)

Implementation Reference

  • Core handler function that executes the create_project tool logic: creates project directory, chunks subdir, project.json config, and updates in-memory projects map.
    async createProject(name, description = '', selectedBooks = []) { const projectPath = path.join(CONFIG.RAG.PROJECTS_DIR, name); if (fs.existsSync(projectPath)) { throw new Error(`Project '${name}' already exists`); } // Create project directory structure fs.mkdirSync(projectPath, { recursive: true }); fs.mkdirSync(path.join(projectPath, 'chunks'), { recursive: true }); const projectConfig = { name, description, created_at: new Date().toISOString(), books: selectedBooks, chunk_count: 0, vector_dimension: CONFIG.RAG.VECTOR_DIMENSION }; // Save project configuration fs.writeFileSync( path.join(projectPath, 'project.json'), JSON.stringify(projectConfig, null, 2) ); this.projects.set(name, projectConfig); this.log(`Created project: ${name}`); return projectConfig; }
  • Input schema definition for the create_project tool, specifying required 'name' parameter and optional 'description'.
    inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Project name (alphanumeric and underscores only)' }, description: { type: 'string', description: 'Project description' } }, required: ['name'] }
  • server.js:1012-1029 (registration)
    Tool registration entry in the tools/list response, defining name, description, and schema.
    { name: 'create_project', description: 'Create a new RAG project for vector-based book search', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Project name (alphanumeric and underscores only)' }, description: { type: 'string', description: 'Project description' } }, required: ['name'] } },
  • MCP tools/call dispatcher case for 'create_project' that validates input, calls the core createProject handler, and formats the MCP response.
    case 'create_project': const projectName = args.name; const projectDesc = args.description || ''; if (!projectName) { this.sendError(id, -32602, 'Missing required parameter: name'); return; } if (!/^[a-zA-Z0-9_]+$/.test(projectName)) { this.sendError(id, -32602, 'Project name must contain only alphanumeric characters and underscores'); return; } try { const newProject = await this.createProject(projectName, projectDesc); this.sendSuccess(id, { content: [{ type: 'text', text: `Created project '${projectName}' successfully!\n\nNext steps:\n1. Search for books using the 'search' tool\n2. Add books to the project using 'add_books_to_project'\n3. Use 'search_project_context' for RAG queries` }], project: newProject }); } catch (error) { this.sendError(id, -32603, error.message); } break;

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/ispyridis/calibre-rag-mcp-nodejs'

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