Skip to main content
Glama
test-connection.ts2.04 kB
/** * Test script to verify Google Tasks API connection * * Usage: bun run test-connection.ts * * Make sure you have .env file with: * - GOOGLE_CLIENT_ID * - GOOGLE_CLIENT_SECRET * - GOOGLE_REFRESH_TOKEN * * Note: Bun automatically loads .env files, so variables should be available in process.env */ import { GoogleTasksService } from './src/services/GoogleTasksService.js'; async function testConnection() { // Bun automatically loads .env files, so variables should be in process.env const clientId = process.env.GOOGLE_CLIENT_ID; const clientSecret = process.env.GOOGLE_CLIENT_SECRET; const refreshToken = process.env.GOOGLE_REFRESH_TOKEN; if (!clientId || !clientSecret || !refreshToken) { console.error('❌ Missing required environment variables:'); console.error(' - GOOGLE_CLIENT_ID:', clientId ? '✓' : '✗'); console.error(' - GOOGLE_CLIENT_SECRET:', clientSecret ? '✓' : '✗'); console.error(' - GOOGLE_REFRESH_TOKEN:', refreshToken ? '✓' : '✗'); console.error('\nPlease create a .env file with these variables.'); process.exit(1); } console.log('🔌 Testing Google Tasks API connection...\n'); try { const service = new GoogleTasksService( refreshToken, clientId, clientSecret ); console.log('📋 Fetching task lists...'); const taskLists = await service.getTaskLists(); console.log( `✅ Connection successful! Found ${taskLists.length} task list(s):\n` ); if (taskLists.length === 0) { console.log(' (No task lists found)'); } else { taskLists.forEach((list, index) => { console.log(` ${index + 1}. ${list.title} (ID: ${list.id})`); }); } console.log('\n✨ Test completed successfully!'); } catch (error) { console.error('\n❌ Connection test failed:'); if (error instanceof Error) { console.error(` ${error.message}`); } else { console.error(' Unknown error:', error); } process.exit(1); } } testConnection();

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/adamgrzybowski/google-task-mcp'

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