Skip to main content
Glama

Github Project Manager

base-gmail-tool.ts1.3 kB
import { google } from 'googleapis'; import { OAuth2Client } from 'google-auth-library'; import { GmailApiError } from '../errors/gmail-api-error.js'; /** * Base class for Gmail tools */ export class BaseGmailTool { protected readonly gmail; /** * Create a new BaseGmailTool instance * * @param oauth2Client - The authenticated OAuth2 client */ constructor(protected readonly oauth2Client: OAuth2Client) { this.gmail = google.gmail({ version: 'v1', auth: oauth2Client }); } /** * Create a response object with text content * * @param text - The text content * @returns A formatted response object */ protected createResponse(text: string) { return { content: [ { type: 'text' as const, text, }, ], }; } /** * Handle API errors uniformly * * @param error - The caught error * @param operation - The operation that failed * @throws GmailApiError with formatted message */ protected handleError(error: unknown, operation: string): never { throw new GmailApiError(`Failed to ${operation}: ${error instanceof Error ? error.message : String(error)}`); } }

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/Monsoft-Solutions/model-context-protocols'

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