mcp-google-drive
Version:
Advanced MCP server for Google Drive integration with full CRUD operations, file management, and sharing capabilities. Supports both OAuth2 and Service Account authentication.
34 lines • 1.04 kB
JavaScript
import { z } from "zod";
import { BaseToolHandler } from "./BaseToolHandler.js";
const MoveFileSchema = z.object({
fileId: z.string(),
parentId: z.string(),
removeFromParents: z.boolean().default(true),
});
export class MoveFileHandler extends BaseToolHandler {
async runTool(args, drive) {
const validArgs = MoveFileSchema.parse(args);
await this.moveFile(validArgs, drive);
return {
content: [{
type: "text",
text: "File moved successfully",
}],
isError: false,
};
}
async moveFile(args, drive) {
try {
await drive.files.update({
fileId: args.fileId,
addParents: args.parentId,
removeParents: args.removeFromParents ? 'root' : undefined,
fields: 'id,parents',
});
}
catch (error) {
throw this.handleGoogleApiError(error);
}
}
}
//# sourceMappingURL=MoveFileHandler.js.map