search_granola_notes
Search through Granola notes and documents using a query string to find and retrieve matching content for meeting-related information.
Instructions
Search through Granola notes/documents by query string. Returns matching documents with their content.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query to find matching notes/documents | |
| limit | No | Maximum number of results to return (default: 10) |
Implementation Reference
- src/index.ts:161-219 (handler)Main handler for 'search_granola_notes' tool: invokes apiClient.searchDocuments, converts ProseMirror content to markdown, processes results, and returns formatted JSON response.case "search_granola_notes": { const query = args?.query as string; const limit = (args?.limit as number) || 10; const results = await apiClient.searchDocuments(query, limit); const processedResults = await Promise.all( results.map(async (doc) => { let markdown = ""; let hasContent = false; if ( doc.last_viewed_panel && typeof doc.last_viewed_panel === "object" && doc.last_viewed_panel.content && typeof doc.last_viewed_panel.content === "object" && doc.last_viewed_panel.content.type === "doc" ) { markdown = convertProseMirrorToMarkdown( doc.last_viewed_panel.content ); hasContent = markdown.trim().length > 0; } else if ( doc.notes && typeof doc.notes === "object" && doc.notes.type === "doc" ) { markdown = convertProseMirrorToMarkdown(doc.notes); hasContent = markdown.trim().length > 0; } return { id: doc.id, title: doc.title || "Untitled", markdown: markdown.substring(0, 2000) || "", content_preview: markdown.substring(0, 500) || "", has_content: hasContent, created_at: doc.created_at, updated_at: doc.updated_at, }; }) ); return { content: [ { type: "text", text: JSON.stringify( { query, count: processedResults.length, results: processedResults, }, null, 2 ), }, ], }; }
- src/index.ts:28-47 (registration)Tool registration including name, description, and input schema definition.{ name: "search_granola_notes", description: "Search through Granola notes/documents by query string. Returns matching documents with their content.", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query to find matching notes/documents", }, limit: { type: "number", description: "Maximum number of results to return (default: 10)", default: 10, }, }, required: ["query"], }, },
- src/index.ts:32-46 (schema)Input schema defining parameters for the tool: query (required string) and optional limit (number).inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query to find matching notes/documents", }, limit: { type: "number", description: "Maximum number of results to return (default: 10)", default: 10, }, }, required: ["query"], },
- src/granola-api.ts:125-144 (helper)Helper method in GranolaApiClient that performs the actual search by fetching all documents and filtering client-side based on query matching in title, markdown, or content.async searchDocuments( query: string, limit: number = 10 ): Promise<GranolaDocument[]> { const allDocs = await this.getAllDocuments(); const lowerQuery = query.toLowerCase(); return allDocs .filter((doc) => { const title = doc.title?.toLowerCase() || ""; const markdown = doc.markdown?.toLowerCase() || ""; const content = doc.content?.toLowerCase() || ""; return ( title.includes(lowerQuery) || markdown.includes(lowerQuery) || content.includes(lowerQuery) ); }) .slice(0, limit); }