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
|
Only return events starting after this datetime. Defaults to
24 hours ago when
TYPE:
|
cursor
|
TYPE:
|
Source code in src/openjarvis/connectors/gcalendar.py
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 371 372 373 374 375 376 377 378 379 380 381 382 383 384 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 | |
accept_event
¶
Accept a calendar invite by setting responseStatus to 'accepted'.
Source code in src/openjarvis/connectors/gcalendar.py
decline_event
¶
Decline a calendar invite by setting responseStatus to 'declined'.
Source code in src/openjarvis/connectors/gcalendar.py
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
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | |