add_drive
Add a new Google Drive account to the configuration using service account authentication, enabling access to multiple drives for file operations.
Instructions
Add a new Google Drive account to the configuration
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | Optional description | |
| driveId | Yes | Unique ID for this drive (e.g., 'personal', 'work') | |
| name | Yes | Display name for the drive | |
| serviceAccountPath | Yes | Path to Service Account JSON file (e.g., './credentials/personal-sa.json') |
Implementation Reference
- src/mcp/tools/add-drive.ts:35-62 (handler)The async handler function that executes the add_drive tool: destructures params, calls drivesConfigLoader.addDrive, constructs success output, and returns MCP-formatted content with text confirmation and structured data.handler: async (params: { driveId: string; name: string; description?: string; serviceAccountPath: string; }) => { const { driveId, name, description, serviceAccountPath } = params; const added = drivesConfigLoader.addDrive(driveId, { name, description, serviceAccountPath, }); const output = { success: true, drive: { id: driveId, name, description }, }; return { content: [ { type: "text" as const, text: `✅ Drive added successfully:\n${JSON.stringify(added, null, 2)}`, }, ], structuredContent: output, }; },
- src/mcp/tools/add-drive.ts:11-34 (schema)Tool configuration including Zod-based inputSchema (driveId, name, optional description, serviceAccountPath) and outputSchema (success boolean and drive object).config: { title: "Add Google Drive Account", description: "Add a new Google Drive account to the configuration", inputSchema: { driveId: z .string() .describe("Unique ID for this drive (e.g., 'personal', 'work')"), name: z.string().describe("Display name for the drive"), description: z.string().optional().describe("Optional description"), serviceAccountPath: z .string() .describe( "Path to Service Account JSON file (e.g., './keys/personal-sa.json')" ), }, outputSchema: { success: z.boolean(), drive: z.object({ id: z.string(), name: z.string(), description: z.string().optional(), }), }, },
- src/mcp/server.ts:27-30 (registration)Dynamic registration loop that registers all tools (including add_drive via import * as tools from "@/mcp/tools/index.js") using McpServer.registerTool with name, config, and handler.const toolList = Object.values(tools); toolList.forEach((tool) => { server.registerTool(tool.name, tool.config as any, tool.handler as any); });