search_granola_events
Search Granola calendar events using a query string to find and retrieve matching events with their details.
Instructions
Search through Granola calendar events by query string. Returns matching events with details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query to find matching calendar events | |
| limit | No | Maximum number of results to return (default: 10) |
Implementation Reference
- src/index.ts:262-308 (handler)Handler implementation for the 'search_granola_events' tool. It retrieves all documents, filters those with google_calendar_event fields matching the query in summary or description, limits results, maps to event details, and returns JSON-formatted response.case "search_granola_events": { const query = args?.query as string; const limit = (args?.limit as number) || 10; const allDocs = await apiClient.getAllDocuments(); const eventResults = allDocs .filter((doc) => { const event = doc.google_calendar_event; if (!event) return false; const summary = event.summary?.toLowerCase() || ""; const description = event.description?.toLowerCase() || ""; const lowerQuery = query.toLowerCase(); return ( summary.includes(lowerQuery) || description.includes(lowerQuery) ); }) .slice(0, limit) .map((doc) => ({ id: doc.google_calendar_event?.id || doc.id, summary: doc.google_calendar_event?.summary, description: doc.google_calendar_event?.description?.substring( 0, 500 ), start: doc.google_calendar_event?.start, end: doc.google_calendar_event?.end, attendees: doc.google_calendar_event?.attendees, htmlLink: doc.google_calendar_event?.htmlLink, })); return { content: [ { type: "text", text: JSON.stringify( { query, count: eventResults.length, results: eventResults, }, null, 2 ), }, ], }; }
- src/index.ts:68-87 (registration)Registration of the 'search_granola_events' tool in the tools list, including name, description, and input schema definition.{ name: "search_granola_events", description: "Search through Granola calendar events by query string. Returns matching events with details.", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query to find matching calendar events", }, limit: { type: "number", description: "Maximum number of results to return (default: 10)", default: 10, }, }, required: ["query"], }, },
- src/index.ts:72-86 (schema)Input schema for the 'search_granola_events' tool, defining query (required string) and optional limit (number).inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query to find matching calendar events", }, limit: { type: "number", description: "Maximum number of results to return (default: 10)", default: 10, }, }, required: ["query"], },