Skip to content

Commit

Permalink
Updated GDrive
Browse files Browse the repository at this point in the history
  • Loading branch information
maheshmurag committed Nov 20, 2024
1 parent 0c5ec31 commit dc455ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/gdrive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://<file_id>`)
- **Files** (`gdrive:///<file_id>`)
- Supports all file types
- Google Workspace files are automatically exported:
- Docs → Markdown
Expand Down
6 changes: 3 additions & 3 deletions src/gdrive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})),
Expand All @@ -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({
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit dc455ee

Please sign in to comment.