Skip to main content
Glama
rishipradeep-think41

Google Workspace MCP Server

list_events

Retrieve upcoming calendar events within specified time ranges using the Google Calendar API, with customizable start and end times, and control over the number of events returned.

Instructions

List upcoming calendar events

Input Schema

NameRequiredDescriptionDefault
maxResultsNoMaximum number of events to return (default: 10)
timeMaxNoEnd time in ISO format
timeMinNoStart time in ISO format (default: now)

Input Schema (JSON Schema)

{ "properties": { "maxResults": { "description": "Maximum number of events to return (default: 10)", "type": "number" }, "timeMax": { "description": "End time in ISO format", "type": "string" }, "timeMin": { "description": "Start time in ISO format (default: now)", "type": "string" } }, "type": "object" }

Implementation Reference

  • The handler function that executes the list_events tool. It fetches upcoming calendar events from Google Calendar API using the provided parameters (maxResults, timeMin, timeMax), formats them, and returns as JSON text content.
    private async handleListEvents(args: any) { try { const maxResults = args?.maxResults || 10; const timeMin = args?.timeMin || new Date().toISOString(); const timeMax = args?.timeMax; const response = await this.calendar.events.list({ calendarId: "primary", timeMin, timeMax, maxResults, singleEvents: true, orderBy: "startTime", }); const events = response.data.items?.map((event) => ({ id: event.id, summary: event.summary, start: event.start, end: event.end, location: event.location, })); return { content: [ { type: "text", text: JSON.stringify(events, null, 2), }, ], }; } catch (error: any) { return { content: [ { type: "text", text: `Error fetching calendar events: ${error.message}`, }, ], isError: true, }; } }
  • src/index.ts:160-180 (registration)
    Tool registration in the listTools response, including name, description, and input schema definition.
    { name: "list_events", description: "List upcoming calendar events", inputSchema: { type: "object", properties: { maxResults: { type: "number", description: "Maximum number of events to return (default: 10)", }, timeMin: { type: "string", description: "Start time in ISO format (default: now)", }, timeMax: { type: "string", description: "End time in ISO format", }, }, }, },
  • Input schema definition for the list_events tool, specifying parameters for filtering and limiting events.
    inputSchema: { type: "object", properties: { maxResults: { type: "number", description: "Maximum number of events to return (default: 10)", }, timeMin: { type: "string", description: "Start time in ISO format (default: now)", }, timeMax: { type: "string", description: "End time in ISO format", }, }, },
  • Dispatch case in the CallToolRequest handler that routes list_events calls to the handleListEvents function.
    case "list_events": return await this.handleListEvents(request.params.arguments);

Other Tools

Related Tools

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/rishipradeep-think41/gsuite-mcp'

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