mcp-gdrive-enhanced-markov
Version:
MCP server for Google Drive and Sheets with write capabilities, AI-powered PDF analysis, SQLite document indexing, and advanced directory exploration tools
40 lines (39 loc) • 1.33 kB
JavaScript
import { z } from 'zod';
import { indexer } from './indexer.js';
export const name = 'gdrive_index_file';
export const description = 'Index a single Google Drive file using AI to extract metadata and store in local SQLite database';
export const inputSchema = z.object({
fileId: z.string().describe('The Google Drive file ID to index')
});
export const schema = {
name,
description,
inputSchema: {
type: 'object',
properties: {
fileId: { type: 'string', description: 'The Google Drive file ID to index' }
},
required: ['fileId']
}
};
export async function gdrive_index_file(args) {
try {
const documentId = await indexer.indexFile(args.fileId);
if (documentId === -1) {
return {
content: [{ type: 'text', text: `File skipped - only PDF files are currently supported for indexing` }],
isError: false
};
}
return {
content: [{ type: 'text', text: `Successfully indexed file with document ID: ${documentId}` }],
isError: false
};
}
catch (error) {
return {
content: [{ type: 'text', text: `Error indexing file: ${error instanceof Error ? error.message : 'Unknown error'}` }],
isError: true
};
}
}