Skip to main content
Glama
ispyridis

Calibre RAG MCP Server

by ispyridis

fetch

Extract specific content from ebooks using epub URLs to retrieve targeted book passages for research or reference purposes.

Instructions

Fetch specific content from a book using epub:// URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesepub:// URL from search results

Implementation Reference

  • server.js:988-1001 (registration)
    Registration of the 'fetch' tool in the tools list, including name, description, and input schema.
    { name: 'fetch', description: 'Fetch specific content from a book using epub:// URL', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'epub:// URL from search results' } }, required: ['url'] } },
  • Input schema for the 'fetch' tool defining the expected 'url' parameter.
    inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'epub:// URL from search results' } }, required: ['url'] }
  • Handler for the 'fetch' tool call; currently a placeholder that returns an error indicating implementation is pending.
    case 'fetch': // Implementation would be similar to original this.sendError(id, -32601, 'Fetch tool implementation pending'); break;
  • Helper function to create epub:// URLs used by the 'fetch' tool.
    createEpubUrl(author, title, id, startLine = '', endLine = '') { const encAuthor = encodeURIComponent(author); const encTitle = encodeURIComponent(title); let url = `epub://${encAuthor}/${encTitle}@${id}`; if (startLine && endLine) { url += `#${startLine}:${endLine}`; } return url; }
  • Helper function to parse epub:// URLs for the 'fetch' tool implementation.
    parseEpubUrl(url) { url = url.replace(/^epub:\/\//, ''); const idMatch = url.match(/@(\d+)/); if (!idMatch) { throw new Error('Invalid epub URL format'); } const bookId = idMatch[1]; let startLine = ''; let endLine = ''; const rangeMatch = url.match(/#(\d+):(\d+)$/); if (rangeMatch) { startLine = rangeMatch[1]; endLine = rangeMatch[2]; } return { bookId, startLine, endLine }; }

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