granola
diapason.connectors.granola
¶
Granola connector — syncs meeting notes via the Granola public API.
Uses an API key (Bearer token) stored locally. All network calls are
isolated in module-level functions (_granola_api_*) to make them
trivially mockable in tests.
Users create an API key in the Granola desktop app under Settings → API (requires Business or Enterprise plan).
GranolaConnector
¶
Bases: BaseConnector
Connector that syncs meeting notes from Granola via the public REST API.
Authentication uses an API key created in the Granola desktop app (Settings → API, requires Business or Enterprise plan). The key is stored locally in a JSON credentials file.
Parameters¶
api_key:
Granola API key. If provided, it takes priority over any stored
credentials file.
credentials_path:
Path to the JSON file where the API key is stored. Defaults to
~/.diapason/connectors/granola.json.
auth_url()
¶
Return the URL where users can create a Granola API key.
Users must open the Granola desktop app and navigate to Settings → API to generate their key.
disconnect()
¶
Clear the in-memory API key and delete the stored credentials file.
handle_callback(code)
¶
Validate and persist the API key.
The code parameter holds the raw API key string provided by the
user. The key is verified with a live GET /v1/notes?limit=1
probe before it is written, so an invalid key can never overwrite
a working credential on disk (raises :class:GranolaKeyError on a
401/403).
is_connected()
¶
Return True if a valid API key is available.
mcp_tools()
¶
Expose two MCP tool specs for real-time Granola queries.
sync(*, since=None, cursor=None)
¶
Yield :class:Document objects for Granola meeting notes.
Paginates through GET /v1/notes and fetches each note's full
content (summary + transcript) via GET /v1/notes/{id}.
Parameters¶
since:
If provided, only notes created after this datetime are returned
(passed as created_after to the API).
cursor:
Pagination cursor from a previous sync to resume paginating.
sync_status()
¶
Return sync progress from the most recent :meth:sync call.
GranolaKeyError
¶
Bases: ValueError
Raised when a Granola API key is missing or rejected by the API.
Surfaced through the /connect endpoint as an HTTP 400 so the user
sees why the key was refused instead of a silent failed sync later.