gcalendar
gcalendar
¶
Google Calendar connector — event sync via the Calendar REST API v3.
Uses OAuth 2.0 tokens stored locally (see :mod:openjarvis.connectors.oauth).
All network calls are isolated in module-level functions (_gcal_api_*)
to make them trivially mockable in tests.
Classes¶
GCalendarConnector
¶
Bases: BaseConnector
Connector that syncs events from Google Calendar via the REST API v3.
Authentication is handled through Google OAuth 2.0. Tokens are stored locally in a JSON credentials file.
| PARAMETER | DESCRIPTION |
|---|---|
credentials_path
|
Path to the JSON file where OAuth tokens are stored. Defaults to
TYPE:
|
Source code in src/openjarvis/connectors/gcalendar.py
Functions¶
is_connected
¶
Return True if a credentials file with a valid access token exists.
Source code in src/openjarvis/connectors/gcalendar.py
disconnect
¶
auth_url
¶
Return a Google OAuth consent URL requesting calendar.readonly scope.
Source code in src/openjarvis/connectors/gcalendar.py
handle_callback
¶
Handle the OAuth callback.
If code looks like a client_id:client_secret pair (containing
.apps.googleusercontent.com), store the credentials and trigger
the full browser-based OAuth flow. Otherwise treat it as a raw
token / auth code.
Source code in src/openjarvis/connectors/gcalendar.py
sync
¶
sync(*, since: Optional[datetime] = None, cursor: Optional[str] = None) -> Iterator[Document]
Yield :class:Document objects for Google Calendar events.
Fetches all calendars from the calendarList endpoint, then paginates through each calendar's events.
| PARAMETER | DESCRIPTION |
|---|---|
since
|
Not yet used (filtering is done server-side via
TYPE:
|
cursor
|
TYPE:
|
Source code in src/openjarvis/connectors/gcalendar.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
sync_status
¶
sync_status() -> SyncStatus
Return sync progress from the most recent :meth:sync call.
Source code in src/openjarvis/connectors/gcalendar.py
mcp_tools
¶
mcp_tools() -> List[ToolSpec]
Expose three MCP tool specs for real-time Google Calendar queries.
Source code in src/openjarvis/connectors/gcalendar.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |