gcontacts
gcontacts
¶
Google Contacts connector — bulk contact sync via the People REST API v1.
Uses OAuth 2.0 tokens stored locally (see :mod:openjarvis.connectors.oauth).
All network calls are isolated in module-level functions (_gcontacts_api_*)
to make them trivially mockable in tests.
Classes¶
GContactsConnector
¶
Bases: BaseConnector
Connector that syncs contacts from Google Contacts via the People API v1.
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/gcontacts.py
Functions¶
is_connected
¶
Return True if a credentials file with a valid access token exists.
Source code in src/openjarvis/connectors/gcontacts.py
disconnect
¶
auth_url
¶
Return a Google OAuth consent URL requesting contacts.readonly scope.
Source code in src/openjarvis/connectors/gcontacts.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/gcontacts.py
sync
¶
sync(*, since: Optional[datetime] = None, cursor: Optional[str] = None) -> Iterator[Document]
Yield :class:Document objects for Google Contacts.
Paginates through the people/me/connections endpoint and converts each person resource into a Document.
| PARAMETER | DESCRIPTION |
|---|---|
since
|
Not yet used (People API does not support server-side date filtering for connections).
TYPE:
|
cursor
|
TYPE:
|
Source code in src/openjarvis/connectors/gcontacts.py
sync_status
¶
sync_status() -> SyncStatus
Return sync progress from the most recent :meth:sync call.
Source code in src/openjarvis/connectors/gcontacts.py
mcp_tools
¶
mcp_tools() -> List[ToolSpec]
Expose two MCP tool specs for real-time Google Contacts queries.