Skip to main content
Glama

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
NameRequiredDescriptionDefault
descriptionNoOptional description
driveIdYesUnique ID for this drive (e.g., 'personal', 'work')
nameYesDisplay name for the drive
serviceAccountPathYesPath to Service Account JSON file (e.g., './credentials/personal-sa.json')

Implementation Reference

  • 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, }; },
  • 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(), }), }, },
  • 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); });

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/andresfrei/mcp-drive'

If you have feedback or need assistance with the MCP directory API, please join our Discord server