From dc455ee23a835b930620936b571f360d553c18cd Mon Sep 17 00:00:00 2001 From: Mahesh Murag Date: Wed, 20 Nov 2024 09:58:30 -0500 Subject: [PATCH] Updated GDrive --- src/gdrive/README.md | 2 +- src/gdrive/index.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gdrive/README.md b/src/gdrive/README.md index a62094ee..5fd0e0dc 100644 --- a/src/gdrive/README.md +++ b/src/gdrive/README.md @@ -15,7 +15,7 @@ This MCP server integrates with Google Drive to allow listing, reading, and sear The server provides access to Google Drive files: -- **Files** (`gdrive://`) +- **Files** (`gdrive:///`) - Supports all file types - Google Workspace files are automatically exported: - Docs → Markdown diff --git a/src/gdrive/index.ts b/src/gdrive/index.ts index e080aab0..b9c6d910 100644 --- a/src/gdrive/index.ts +++ b/src/gdrive/index.ts @@ -44,7 +44,7 @@ server.setRequestHandler(ListResourcesRequestSchema, async (request) => { return { resources: files.map((file) => ({ - uri: `gdrive://${file.id}`, + uri: `gdrive:///${file.id}`, mimeType: file.mimeType, name: file.name, })), @@ -53,7 +53,7 @@ server.setRequestHandler(ListResourcesRequestSchema, async (request) => { }); server.setRequestHandler(ReadResourceRequestSchema, async (request) => { - const fileId = request.params.uri.replace("gdrive://", ""); + const fileId = request.params.uri.replace("gdrive:///", ""); // First get file metadata to check mime type const file = await drive.files.get({ @@ -150,7 +150,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => { server.setRequestHandler(CallToolRequestSchema, async (request) => { if (request.params.name === "search") { const userQuery = request.params.arguments?.query as string; - const escapedQuery = userQuery.replace(/'/g, "\\'"); + const escapedQuery = userQuery.replace(/\\/g, "\\\\").replace(/'/g, "\\'"); const formattedQuery = `fullText contains '${escapedQuery}'`; const res = await drive.files.list({