gwsadm-mcp
Use this server to run read-only Google Workspace security-audit and incident-response queries, with one opt-in state-changing sign-out tool.
Check server health, config, per-domain auth/API reachability, optional geo/site metadata.
Audit logins: Google-auto-disabled accounts, suspicious logins, failure top-N.
Report daily Gmail send/receive counts per domain.
Inspect account state: suspended accounts snapshot, one user's suspension/archive/2SV/last-login/org-unit status.
Review third-party OAuth grants for one user.
Trace one user's activity across Workspace apps, flag security-posture changes, list source IPs.
Pivot on one IP to see every account it acted as across domains/apps.
Run a compromise sweep: activity, state, risky OAuth grants, IP reach, Gmail forwarding/filter/delegate/send-as settings and sent-mail summary.
Audit Drive external sharing, link/public exposure, one document's history, shared-drive membership changes.
Review Admin console actions against users/groups or tenant-wide.
Check Google Workspace Status Dashboard incidents.
Trace a known Message-ID across specific mailboxes.
Summarize DMARC RUA reports and top reject-candidate IPs.
Inspect Google Group delivery policy and member roster.
Generate a daily security brief synchronously or as a background job.
Optionally, when
GWSADM_ENABLE_SIGN_OUT=1, sign one user out of all web/device sessions.
Provides read-only security auditing for Google Workspace, including account locks, suspicious logins, and external file sharing monitoring via the Admin SDK Reports API.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gwsadm-mcp run daily security brief"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gwsadm-mcp
English | 日本語
Google Workspace security-audit MCP (Model Context Protocol) server — read-only visibility into account locks, suspicious logins, and external file sharing, built on the Admin SDK Reports API (audit activities).
Named after the admin-console viewpoint (gwsadm = Google Workspace admin),
sibling of boxadm-mcp. This is
not a general-purpose Workspace MCP: it surfaces risk and changes nothing,
with one opt-in exception — sign_out_user, which exists only when the server
is started with GWSADM_ENABLE_SIGN_OUT=1.
Features
Tool | Description |
| Server version, config path, and per-domain auth probe — call at session start or after a timeout |
| Reports API |
| Reports API |
| Directory API — current snapshot of suspended accounts ( |
| Directory API |
| Directory API |
| State-changing, opt-in. Directory API |
| Reports API |
| Reports API |
| The Google-side follow-through after one account is confirmed compromised, in one call: |
| Reports API |
| Reports API |
| Reports API |
| Reports API |
| Google Workspace Status Dashboard (public feed, no credential) — open incidents and those that ended within the window, optionally for one product ( |
| Gmail API — did a known Message-ID reach specific mailboxes, and where (inbox/spam/trash/archived)? For each recipient it impersonates that user via DWD and searches their own mailbox. Requires the separate |
| Gmail API — DMARC aggregate (RUA) report pass/fail summary and top reject-candidate source IPs, per domain. Impersonates the domain's configured |
| Groups Settings API — a Google Group's own posting/delivery policy ( |
| Directory API — a Google Group's basic metadata and member roster, resolved directly rather than inferred from who happened to receive one particular message. Requires the separate |
| One-call summary across all configured domains, including account-protection changes (2-Step Verification, passkeys, Advanced Protection, password, recovery address/phone, mail forwarding out of the domain) flagged when they come from outside your home countries ( |
| Same as |
Planned: dlp_events (Reports rules; requires a Workspace edition with DLP),
token_events.
Related MCP server: google-workspace-mcp-advanced
Auth model
Service account with domain-wide delegation (DWD) impersonating an audit-capable admin. Fully non-interactive — no browser, no token refresh rotation — so the server runs unattended (cron, MCP gateway, CI).
Grant all of the following DWD scopes on the same service-account client ID up front, in one setup pass. Adding them one at a time as each tool gets built is how a scope goes missing until the one tool that needed it starts degrading — one place, one pass, avoids the trap:
Scope | Needed by | Missing it |
|
| those tools degrade to a per-domain error |
|
| those tools degrade to an error (per-domain for |
|
| those tools degrade to a per-domain error; everything else keeps working |
health_check needs no scope at all to respond: it is the tool to call when
a grant might be missing — it probes each domain and reports the failing
auth in a structured per-domain result instead of failing itself.
gmail_usage_report needs its own separate scope too, despite living under
the same Admin SDK Reports API as the base pass above — the "Usage report"
family (customerUsageReports) and the "Audit" activity stream
(activities().list, everything else in the base pass) are gated by two
different scopes, and having one does not imply the other:
Scope | Needed by | Missing it |
|
| that tool degrades to a per-domain error; everything else keeps working |
gmail_message_trace and dmarc_rua_summary need one more scope, granted as
a separate step — it is intentionally not bundled into the pass above:
Scope | Needed by | Missing it |
|
| those tools report a per-recipient/per-domain error; everything else keeps working |
This is a materially broader grant than the three above: it allows reading
message content for any user the service account impersonates, not just
metadata. gmail_message_trace only ever requests format="metadata" — it
never reads a message body — but dmarc_rua_summary DOES read content: it
fetches the compressed DMARC report attachment each RUA message carries
(format="full" plus attachments().get()) and parses it. Both stay within
what the grant allows either way, but only gmail_message_trace stays inside
the narrower "metadata only" habit; the narrower gmail.metadata scope was
considered and rejected for both tools because it does not support the q=
search parameter the rfc822msgid:/RUA-mailbox lookups need. Grant it on the
same service-account client ID as the other scopes (Admin console →
Security → API controls → Domain-wide delegation → find the existing client
ID → add this scope to its list), and weigh that broader exposure against how
much you actually need message-trace/DMARC reporting before turning it on for
a given domain.
group_delivery_policy and list_group_members each need their own
separate scope too — three more grants beyond the base pass, none bundled
with each other or with gmail.readonly above:
Scope | Needed by | Missing it |
|
| that tool degrades to an error; everything else keeps working |
|
| that half reports its own error; the member roster half still works independently if its own scope below is granted |
|
| same, independent of the metadata half above — the two calls never gate each other |
The Groups Settings API is a distinct product from the Directory API, hence
the separate scope; it has no readonly-only variant, but this server only
ever calls groups().get(), never a mutating method.
suspended_accounts, get_user and user_oauth_tokens all operate per
configured domain (Directory domain=/userKey=), unlike the customer-wide
Reports tools — so every domain you want covered (e.g. a separate student
domain) needs its own [domain.*] config section. Note the failure modes
differ: suspended_accounts silently omits an unconfigured domain from
its result, while get_user and user_oauth_tokens fail loudly with an
unknown-domain error (both take a domain override for an alias/secondary
address whose suffix has no section of its own).
Setup
# uv
uv pip install gwsadm-mcp
# pip
pip install gwsadm-mcpOr from source:
git clone https://github.com/shigechika/gwsadm-mcp.git
cd gwsadm-mcp
# uv
uv sync
# pip
pip install -e .Configuration
Point GWSADM_CONFIG at an INI file (default ~/.config/gwsadm-mcp/config.ini,
keep it 0600):
[gwsadm]
# optional; defaults to all [domain.*] section names
internal_domains = example.edu, mail.example.edu
[domain.example.edu]
service_account_file = /path/to/service-account.json
subject = audit-admin@example.edu
customer_id = C0xxxxxxx
dmarc_rua_mailbox = postmaster@example.edu # optional, default: postmaster@<domain>; "none" opts out
dmarc_rua_recipient = postmaster+rua@example.edu # optional, default: same as dmarc_rua_mailboxOne [domain.*] section per audited Workspace domain. internal_domains is
the allowlist used to classify sharing targets as internal vs external.
dmarc_rua_mailbox is the real user dmarc_rua_summary impersonates to read
DMARC aggregate reports — domain-wide delegation can only act as an actual user,
never as a group or alias. dmarc_rua_recipient is the address the reports are
sent to (the rua=mailto: value published in the domain's _dmarc record) and
is used only to narrow the Gmail search (to:<recipient>); it defaults to the
mailbox. Set it when the published address is a Gmail plus-subaddress such as
postmaster+rua@ (searching on it also keeps ruf= failure reports sent to
postmaster+ruf@ out of the aggregate parse) or a group that fans out to the
impersonated inbox. dmarc_rua_mailbox = none opts a domain out of DMARC reading
— e.g. when its rua= points at another domain's mailbox that a different
[domain.*] section already reads; reports are grouped by the policy domain each
report names, so they still appear under that other section.
Environment variables (all optional except where noted):
Variable | Default | Meaning |
|
| the INI file above |
|
| concurrent Reports API fetches in the fan-out (clamped to 1–32; a non-integer falls back to 8). Lower it if a tenant throttles, raise it if a large tenant's scan is too slow |
| — | your own address ranges, to name where an account-protection change came from (see the setup docs) |
| — | iptoasn table and home countries, to flag changes from abroad (see the setup docs) |
| unset |
|
|
| time budget of one |
Usage
Claude Code (plugin)
This repository doubles as a single-plugin marketplace, so Claude Code can install the server for you:
/plugin marketplace add shigechika/gwsadm-mcp
/plugin install gwsadm-mcp@gwsadm-mcpThe plugin launches uvx gwsadm-mcp and reads GWSADM_CONFIG (falls back to
~/.config/gwsadm-mcp/config.ini), the same variable described in
Configuration. /plugin install only wires up the server
process — it cannot create the config INI or the Google Cloud service-account
JSON key(s) it points at; both must already exist on the machine running the
plugin before any tool call will succeed.
uvx must be on the PATH of the process that runs Claude Code — a login
shell usually has it, but a GUI-launched app may not; install
uv system-wide if the plugin fails to start.
Claude Code (manual)
Add to .mcp.json (no env needed when the config lives at the default path;
add "env": { "GWSADM_CONFIG": "..." } only for a non-default location):
{
"mcpServers": {
"gwsadm-mcp": {
"type": "stdio",
"command": "gwsadm-mcp"
}
}
}Claude Desktop
Add the same entry to claude_desktop_config.json.
Codex
codex mcp add gwsadm-mcp -- gwsadm-mcpAdd --env GWSADM_CONFIG=... (before --) only if the config INI is not at
the default path (~/.config/gwsadm-mcp/config.ini).
Gemini CLI
Add to ~/.gemini/settings.json (or a project's .gemini/settings.json):
{
"mcpServers": {
"gwsadm-mcp": {
"command": "gwsadm-mcp"
}
}
}As with Codex, add "env": { "GWSADM_CONFIG": "..." } only for a non-default
config location. To expose only some tools, list them in includeTools.
Any other MCP client that launches stdio servers works the same way: give it
gwsadm-mcp as the command.
Direct Execution
gwsadm-mcpCLI Options
gwsadm-mcp --version # Print version and exit
gwsadm-mcp --check # Config + auth + API smoke for every domain, then exit
gwsadm-mcp # Start MCP server (STDIO, default)--check exit codes: 0 success, non-zero on config or auth failure.
Archiving DMARC reports (batch)
dmarc_rua_summary aggregates a rolling window for a patrol. To keep a day-by-day history, a scheduled job can dump the reports themselves:
gwsadm-mcp dmarc-reports --domain example.edu --since 2026-09-20 --until 2026-09-23 > reports.jsonReads the same RUA mailbox as
dmarc_rua_summary(samegmail.readonlyscope) for messages that arrived in[--since, --until)(UTC days, Gmailafter:/before:), every attachment and every ZIP entry (up to 20 entries and 50 MB decompressed per attachment; anything past that, or an encrypted / corrupt entry, is counted innon_report_attachments).Prints one JSON document to stdout: each report whole —
org_name,report_id,begin/end(epoch seconds of the reported period), the publishedpolicy(p,sp,pct,adkim,aspf) and its records withreasonandauth_results. Nothing is aggregated or deduplicated: some reporters split one report across several messages under the samereport_id, so deduplicate on content, not on the id.fetch_completeis true only when nothing was capped and no message, attachment or record was skipped (message_errors,non_report_attachments,dropped_records).Exit
2for a bad argument or configuration,1for an API or auth failure (e.g. the scope was revoked); nothing is written to stdout in either case.The output contains sender IPs and header domains. Keep it out of anything published.
Notes
Every result section reports
capped: truewhen a window exceeded the page budget, or when a probe's fetch errored outright (seeevent_errors) — partial coverage is never presented as "no findings". The drive scan also reportscapped_events(which eventNames were cut short). Narrowhoursor raisemax_pagesfor full coverage — on a large tenant, term-time weekdays can produce thousands ofchange_user_accessevents/day.Google's
visibility=shared_externallyis relative to the file owner's domain, so with multipleinternal_domainsa cross-internal-domain grant (e.g. student domain → staff domain) carries it too. External-ness is therefore judged againstinternal_domainsusing the grant's target:target_userfor named grants,target_domainfor domain-scoped grants (e.g. "anyone at partner.edu"; the literal domain"all"means "anyone with the link" and is judged by visibility instead).risky_visibility_eventscounts only transitions intopeople_with_link/public_on_the_web(excluding a narrowing from public down to link-only).untargeted_external_transitionsis a residual bucket for transitions intoshared_externallywith no target address or domain to classify — it is not a cross-check for grants missed elsewhere, since domain-scoped grants are already counted above.external_samples/exposure_samples/untargeted_sampleshold examples of each.Drive events are queried one audit-relevant eventName at a time, so the page budget is not consumed by view/edit noise; an event name rejected by the API degrades into
event_errorsinstead of failing the tool.change_document_visibilityandchange_document_access_scopereport the same transition as simultaneous sibling events on this API — only the latter drives classification (the former is fetched for itsacl_eventscount only), so a domain-scoped grant or a link/public exposure is never double-counted across the two. This also means the former can no longer compensate if the latter's own fetch fails: achange_document_access_scopeentry inevent_errorssetscapped: truefor that domain, and its classification counts for the window are a lower bound even thoughchange_document_visibility(and thusacl_events) may show data.A failure in one domain degrades only that domain's section (
{"error": ...}).gmail_message_tracesetsambiguous: true(withmatch_count) on a recipient whose mailbox has more than one message under the same Message-ID (mailing-list copy plus a direct CC, a quarantine-release duplicate, …) — the rest of that recipient's fields describe only the first match, not a combined answer.match_count_cappedis set alongside it when the mailbox has enough matches thatmatch_countis a lower bound rather than exact (the search does not paginate).get_userdistinguishes "this address names no account" from "the lookup failed": a plain HTTP 404 answersfound: falsewith no state fields, which is a diagnostic result — a typo'd or deleted address — and never anerror. A missing DWD scope or a transient failure answers{"error": ...}with nofoundkey instead, so the two can never be confused in either direction. Fields Google omits staynullrather than being coerced: a missingsuspendedmust not read as "the account is fine".group_delivery_policynormalizes the Groups Settings API's"true"/"false"string fields (a quirk of that API, not JSON booleans) into real booleans in its output; a field absent from Google's response staysnull, never coerced tofalse.list_group_membersruns its group-metadata and member-roster lookups independently — a tenant with only one of the two DWD scopes still gets that one section, the other reported as{"error": ...}in its place. It reportscapped: trueboth when the member roster exceeded its page budget (default 20 pages × 200/page) and when the member lookup failed outright (seemembers_error) — either way the roster is not the full one, and an emptymemberslist must never be read as a confirmed-empty group whencappedis true. Both group tools distinguish "this address is not a group" (a plain HTTP 404, verified against production for all three underlying API calls) from a real failure:group_delivery_policysetsfound: false;list_group_memberssets it too, when either both independent lookups agree with no error on either side, OR one CONFIRMS not-found while the other independently failed (that failure is then attached asgroup_lookup_error/members_lookup_errorrather than hidden) — a confirmed non-existence outweighs an unrelated error on the other scope. Only a genuine mixed state (one side not-found, the other actually finding data) falls through to the normal per-section shape instead.Read-only by design, with one opt-in exception. The only read calls issued are
activities().list()andcustomerUsageReports().get()(Reports API);users().list(),users().get(),tokens().list(),groups().get(),members().list()(Directory API);groups().get()(Groups Settings API); and in the Gmail APImessages().list()/messages().get(format="metadata")forgmail_message_traceandcompromise_sweep(the latter with the To/Cc/Bcc/Date headers only),messages().list()/messages().get(format="full")/messages().attachments().get()fordmarc_rua_summary(which does read the report attachments, not just metadata), the settings readsusers().settings().getAutoForwarding()/forwardingAddresses().list()/filters().list()/delegates().list()/sendAs().list()forcompromise_sweep, andusers().getProfile()for thehealth_checkGmail probe. The only write isusers().signOut()(Directory API), issued solely bysign_out_user— which exists only when the server starts withGWSADM_ENABLE_SIGN_OUT=1.workspace_statusalso GETs Google's public status feed without a credential.Output contains account addresses (that is the point of an audit tool): restrict access to authorized security staff.
gmail_message_tracealso returns a message snippet and headers (From/To/Cc/Subject/Date) for a matched message — treat its output with the same care as the mailbox content it is drawn from.
Development
git clone https://github.com/shigechika/gwsadm-mcp.git
cd gwsadm-mcp
# uv
uv sync --dev
uv run pytest -v
uv run ruff check .
# pip
python3 -m venv .venv
.venv/bin/pip install -e . && .venv/bin/pip install pytest ruff
.venv/bin/pytest -v
.venv/bin/ruff check .Live smoke test
The unit suite never talks to Google, which is what makes it fast — and also
what makes it blind to a tool that has stopped returning real data.
scripts/smoke_test.py runs every registered tool against the configured
tenant and fails on empty, malformed or error answers:
# uses the same config file as the server (GWSADM_CONFIG)
uv run python scripts/smoke_test.py
uv run python scripts/smoke_test.py --only oauth --tracebackRead-only. Every tool exercised here reads an audit log or a directory snapshot; nothing in Workspace is changed (
sign_out_useris skipped).daily_brief_startcreates a job inside the process, which expires on its own.No payloads in the report. Tool names, statuses and row counts only; server-authored error text is redacted too, since these tools deal in account addresses and document titles throughout.
Bounded. Every bounding parameter a tool offers is passed explicitly — the defaults (5 pages, 180 days, 200 events) are sized for a human asking once, and are enforced by a test that finds them from the source.
Nothing tenant-specific in the specs. The account and the document the per-user and per-document tools need are discovered at run time, and skipped when the tenant has none to offer. Two tests keep it that way: one refuses those parameters as literals, the other bans anything address-shaped anywhere in the file, because this repository is public.
An empty answer passes: no external sharing and no locked accounts is the desired state. What is asserted instead is the envelope — and, where the answer is keyed by domain, that the domain map is not empty, since a config resolving to zero domains would otherwise report every tool as working while auditing nothing.
CI enforces the cheap half: a tool registered without a probe spec fails the build (
tests/test_smoke_probes.py), so adding a tool forces the question "how would we know it works?".scripts/smoke_harness.pyis the engine and holds no Workspace knowledge: it is kept identical across the servers that share it, so fix engine bugs once and sync the file rather than patching this copy.
Releasing
Releases are automated with release-please.
Merging Conventional Commits (feat:, fix:, …)
to main keeps a release PR open with the next version and changelog. Merging
that PR tags vX.Y.Z and publishes a GitHub Release, whose release: published
event triggers the release workflow to build and publish to PyPI and the MCP
Registry. release-please owns the version in gwsadm_mcp/__init__.py and
server.json (do not bump them by hand).
The release-please workflow should be given a repository secretRELEASE_PLEASE_TOKEN (a PAT with contents: write + pull-requests: write).
The default GITHUB_TOKEN cannot create the Release that triggers the
downstream release workflow (GitHub blocks workflow runs triggered by
GITHUB_TOKEN), so without the PAT nothing gets published. The workflow falls
back to GITHUB_TOKEN when the secret is unset so PR CI keeps working on forks.
License
MIT
Available Tools
21 toolsadmin_actionsA
What administrators did in the Admin console: to one account or group, or tenant-wide.
Answers "did someone (IT staff, a sync job) suspend this account, reset
its password, move it to another org unit, or take it out of a group?"
from the Admin console audit log (Reports API applicationName=admin).
Each row names the actor (the administrator's address, or a profile
id for a service account or sync client), actor_ip, the
event_type (USER_SETTINGS, GROUP_SETTINGS, ...), the
event (SUSPEND_USER, UNSUSPEND_USER, CHANGE_PASSWORD,
CHANGE_USER_ORGANIZATION, ADD_GROUP_MEMBER,
REMOVE_GROUP_MEMBER, CREATE_USER, DELETE_USER,
CHANGE_APPLICATION_SETTING, ...) and its parameters as the API
names them (USER_EMAIL, GROUP_EMAIL, ORG_UNIT_NAME,
SETTING_NAME, OLD_VALUE, NEW_VALUE, ...; long values cut at
300 characters). What the account did itself (its own password change,
a second factor it enrolled) is not here: use user_activity.
With target (a user or group address), the domain is taken from its
suffix and two server-side filters run, USER_EMAIL==<target> and
GROUP_EMAIL==<target>; an event of a bulk activity that names some
other address is skipped and counted in sibling_events_skipped, as
is a sibling of another name when event is given.
Without it, every admin action of the window is read (each configured
domain, or domain). event narrows to one event name.
Per domain: events newest first (cut at max_events,
events_truncated), by_event and by_actor counts over every
matching event, capped (more pages existed) and errors (a probe
that failed; a domain whose credentials failed is {"error": ...}).
capped at the top is set when any domain was capped or failed.
Reports data can lag by hours, so an empty window right after the fact
is "not visible yet", not "nothing happened". Read-only, the same
admin.reports.audit.readonly DWD scope as login_audit.
Args:
target: A user or group email address (name@domain), or omit for
every admin action.
hours: Window length ending now (at most 4320, the ~6 months the
Reports API keeps).
event: One admin event name in upper case, e.g. SUSPEND_USER.
domain: Configured domain to read (default: the target's suffix, or
every configured domain).
max_pages: Reports page budget per probe (1000 events per page; 1..20).
max_events: Rows listed per domain (1..1000); the counts cover everything fetched.
Inputs: event, hours, domain, target, +2 more.
compromise_sweepA
The Google-side follow-through after ONE account is confirmed compromised, in one call.
Four questions, each answered from its own source and reported in its own section so that a failure in one never hides the others:
activity: what the account did (user_activityfor the window, flags first -- a2sv_enrollfrom the attacker is the item that survives a password reset). A Reports failure stays in this section aserror; the others are still attempted with their own grants.state/grants: what the account is now (get_user: suspended, 2SV enrolled, last login) and which OAuth grants can read or act on content (grants.risky: mail / Drive / contacts / admin scopes; sign-in-only grants are listed but not called out).ips: whether the same sources reached other accounts (ip_activityacross every configured domain for the addresses inips, or, when none are given, for the addresses on the account's own flags -- which include the attacker's, and also the owner's own when they authorized an app or re-authenticated -- capped at SWEEP_MAX_IPS, newest first). The swept account itself is excluded fromother_accounts; a shared egress address (a campus NAT, a gateway host that impersonates accounts) legitimately shows other accounts, so readother_accountsagainst where the address sits.gmail: the settings an attacker leaves behind to keep reading mail (auto-forwarding, forwarding addresses, filters that forward / delete / archive, delegates, send-as aliases and reply-to) plus what the mailbox sent in the window as counts and recipient domains -- never a subject or body. Itskindsays whether it could be read at all:ok,partial(a settings section or the sent summary failed --section_errors/sent.errorsay which; the rest stands),api_disabled(the Gmail API is off in the service account's own Cloud project),no_grant(nogmail.readonlyDWD grant) orerror. A failure is reported as such, never as "nothing found".
highlights lists the facts a responder acts on, one line each, and
checklist what remains to do or verify by hand (second-factor
removal, session sign-out, recovery contacts, message content). Nothing
here changes the account; the identity provider's side of the incident
(and any other SaaS) stays with the caller.
Read-only: Reports API activities().list, Directory users().get
and tokens().list, and Gmail settings.* reads plus
messages().list / messages().get(format="metadata") with the
To / Cc / Bcc / Date headers only.
Args:
username: Exact user email of the compromised account.
hours: Window length ending now, for activity, the IP sweep and sent
mail.
ips: Comma-separated attacker addresses to sweep, at most
SWEEP_MAX_IPS (more is refused, not truncated). Default: the
addresses on the account's own flags, newest first, same cap.
max_pages: Page budget per application for the account's activity
(the IP sweep uses its own small budget).
max_sent: Sent messages whose envelope is fetched, concurrently
(the count covers everything listed).
domain: Configured [domain.*] section for the account. Default:
resolved from the username's suffix. The IP sweep always covers
every configured domain.
Inputs: username (required), ips, hours, domain, +2 more.
daily_briefA
One-call security summary across all configured domains.
Aggregates login_audit (account locks, suspicious logins),
account-protection changes (account_changes: 2-Step Verification
enrolled/disabled, passkeys added/removed, Advanced Protection turned off,
password and recovery address/phone edits, mail forwarding out of the
domain; each row says whether it came from outside the GWSADM_SITES_INI
table and from which country (GWSADM_IP2ASN), and is flagged with
flag_reasons -- foreign (outside GWSADM_HOME_COUNTRIES),
unknown_origin, after_suspicious_login -- flagged rows first, at
most 50 listed, total counts all; suspicious_login_coverage says
whether the last reason is complete) and
drive_external_sharing (external grants, new link exposure, and
untargeted_external_transitions — see that tool's docstring).
max_pages / samples are passed through to the drive scan;
max_pages defaults to the same page budget as the standalone tool,
so both report the same counters for the same window (samples
defaults lower here and only trims the example lists). Per-domain capped in the
summary means at least one underlying scan was partial — treat that
domain's counts as lower bounds (see capped_events in the drive
section for which probes were cut short).
Synchronous: on a large tenant this can exceed a client's ~60s tool-call
timeout. If it does, use daily_brief_start + daily_brief_result
(same result, run in the background) or lower max_pages.
Inputs: hours, samples, max_pages.
daily_brief_resultA
Fetch a daily_brief_start job by id.
status is running (keep polling), done (result holds the full daily_brief
payload), error (error holds the exception type name — the message is omitted to
avoid leaking internal detail), or unknown (bad/expired id).
Inputs: job_id (required).
daily_brief_startA
Start a daily_brief in the background; returns immediately with a job_id.
Use this instead of daily_brief when the synchronous call risks the client's ~60s
tool-call timeout (large tenants). Args mirror daily_brief. You MUST then poll
daily_brief_result(job_id) every few seconds until status is done (the full
daily_brief payload is under result) or error. On a config error returns
{"error": ...}; if too many jobs are already active returns
{"status": "rejected", ...}.
Inputs: hours, samples, max_pages.
dmarc_rua_summaryA
Summarize DMARC aggregate (RUA) reports: pass/fail per domain, top reject-candidate IPs.
Impersonates the domain's configured dmarc_rua_mailbox (a real user --
domain-wide delegation cannot act as a group or alias; config default
postmaster@<domain>), searches it for mail addressed to
dmarc_rua_recipient (the rua=mailto: address published in DNS,
e.g. the postmaster+rua@ plus-subaddress; default: same as the
mailbox), reads the aggregate reports those messages carry, and answers "how much of this domain's mail volume is
passing DMARC, and if we moved the policy to p=reject, what would
actually get blocked?"
A record counts as PASS when either its aligned DKIM or SPF check reads
"pass" (DMARC's own OR semantics) — NOT when both do. A record counts as
a reject candidate when it is already quarantined or rejected (a tenant
already running p=quarantine/p=reject enforces this today), or when
BOTH checks fail with disposition="none" (what a stricter policy would
newly start blocking); everything else is a pass. This distinction
matters a lot in practice: a large share of legitimate mail (mailing-list
forwards, some relays) passes DMARC via SPF alignment alone with DKIM
unaligned, so counting on DKIM alone overstates the failure rate
severalfold.
reject_candidate_ips (the top top per domain by volume) is where
to actually look before flipping a policy to p=reject: a header_from
that names a SUBDOMAIN of the audited domain is governed by that
subdomain's own sp= policy, not the parent's p=, so it is not
necessarily what a p=reject change on the parent would affect.
Requires the gmail.readonly DWD scope — the same one
gmail_message_trace needs, granted PER SERVICE ACCOUNT CLIENT ID in
the Admin console (Security > API controls > Domain-wide delegation),
separately from the admin.directory.* / admin.reports.* scopes
the rest of this server uses.
Read-only: only messages().list/messages().get/
attachments().get against the one configured mailbox are issued —
see DomainClient.fetch_dmarc_rua_records.
Args:
hours: Lookback window. Default 72 (3 days): RUA reports typically
arrive roughly daily per sending source, so a single day's
window risks missing infrequent senders entirely.
domain: Configured [domain.*] section to report on. Default: all
configured domains.
mailbox: Override the configured dmarc_rua_mailbox (the user to
impersonate) for every selected domain. Set this only for an
ad-hoc check against a different inbox than the one in config;
unless recipient is also given, that inbox's own address is
searched. Also re-enables a domain configured with
dmarc_rua_mailbox = none for the duration of the call.
Validated as an email-shaped address (rejected otherwise).
recipient: Override the address searched for (to:) for every
selected domain -- the rua=mailto: value in DNS when it is
not the mailbox itself. Validated as an email-shaped address
(rejected otherwise) before use, since it is interpolated into
a Gmail search query.
max_pages: Gmail messages().list pages (100 messages each) to
walk per domain. capped=true in the result means more pages
existed — a capped fetch UNDER-counts real report volume, not
just a lower bound on some other total, since every matching
message must be walked (there is no server-side aggregate to
fall back on).
top: How many reject-candidate source IPs to return per domain
(highest volume first). The per-domain pass/quarantined/
rejected/undisposed_fail totals themselves are never truncated.
Inputs: top, hours, domain, mailbox, +2 more.
drive_doc_activityA
Full audit history of one Drive document: owner, ACL changes, lifecycle.
The triage companion to drive_external_sharing: a sharing finding names
a doc_id, and judging it requires who OWNS the document (an individual
user vs. a shared drive completely changes the risk read) and its grant
history over time. Uses a server-side doc_id filter, so the page budget
is spent on this one document only.
owner / doc_title are taken from the document's own events (a
shared-drive-owned file reports the drive's name — not a user address — as
owner). events lists ACL and lifecycle events newest-first
(view/edit/download noise is counted in event_counts but not listed);
events_truncated is set when more matched than max_events.
The doc_id filter matches at the ACTIVITY level and one activity can
carry sibling events for OTHER documents (a multi-file share is one
activity with one event per file) — events whose own doc_id parameter
does not match (or is absent) are excluded from every output field and
tallied in sibling_events_skipped instead, so a bulk action cannot
contaminate this document's history or misattribute its owner.
An empty result means no events in the window for the queried tenant —
NOT proof the document does not exist (history older than the Reports API
retention, or a document living in a different tenant, looks the same).
Args:
doc_id: Drive document id (from a sharing finding's doc_id field).
days: How far back to scan (Reports API retains roughly 6 months).
domain: Restrict to one configured domain/tenant (default: all).
max_pages: Reports page cap per domain; capped=true means more existed.
max_events: Cap on listed events (counts are unaffected).
Inputs: doc_id (required), days, domain, max_pages, +1 more.
drive_external_sharingA
Report Drive ACL grants to external targets and new link/public exposure.
Counts grants whose target (target_user address, or target_domain
for domain-scoped grants) is outside the configured internal domains
(revocations are reported separately, not as exposure) and visibility
transitions into link/public access (people_with_link /
public_on_the_web, excluding a narrowing from public down to
link-only; Google's shared_externally is owner-domain relative, so
external-ness is judged by the target instead).
untargeted_external_transitions counts transitions into
shared_externally with no target address or domain (e.g. scope
became "anyone with the link" — target_domain: "all" — or an
unresolved target); it is a residual bucket, not a cross-check for
missed named grants, since domain-scoped grants are already classified
above. external_samples / exposure_samples / untargeted_samples
hold examples of each. A self-grant of owner on change_user_access
/change_acl_editors (a user creating their own new file — every
Form/Sheet/Doc submission does this) is excluded from
risky_visibility_events: it always reports a visibility transition
from a missing prior state, which is indistinguishable from a genuine
narrow-to-wide exposure event by visibility fields alone, but is not
exposure of anything pre-existing. When no target_user is named
(the change_acl_editors shape), a missing target alone is not proof
of creation — an admin bulk-transferring ownership of a pre-existing,
already-shared file (e.g. offboarding) looks the same — so this case is
corroborated against the event's own owner parameter (self-action
only if owner matches the actor); if owner itself is absent the
conservative default is to count it rather than risk dropping a real
ownership change. This exclusion is deliberately never applied to
change_document_access_scope/change_document_visibility
(see SELF_CREATION_GRANT_EVENTS) — those carry no target_user and
can legitimately report new_value: "owner" for a real transition, so
excluding them there would blind this tool's primary signal instead of
just removing creation noise. Each audit-relevant event name is
queried separately so the page budget is not consumed by view/edit noise
(change_document_visibility is fetched for its acl_events count
only — it duplicates change_document_access_scope on this API and
does not drive classification, so it cannot compensate if that probe's
own fetch fails). capped_events lists event names that exceeded
max_pages*1000 events; capped is also set when any probe's fetch
errored outright (see event_errors) — either way, treat that
domain's counts as lower bounds. Narrow hours or raise max_pages
for full coverage (term-time weekdays see >10k change_user_access
events/day).
Shared-drive caveat: a file created INSIDE a shared drive emits
change_user_access events for each existing drive member (ACL
propagation), so an external member merely uploading files looks like
bulk external sharing here. When a finding's documents share one owner
that is a drive NAME rather than a user address, triage with
drive_doc_activity (per-document history: the "grants" coincide with
create/upload by the same actor) and
shared_drive_membership_changes (who added the members, and when).
Inputs: hours, domain, samples, max_pages.
get_userA
Look up ONE named account's current state — the "why can't this person sign in" tool.
Answers a helpdesk ticket that already names the exact address: is the account suspended (and for what reason, since when), archived, enrolled in or enforced into 2-step verification, when did it last log in, which org unit is it in, is a password change pending. One Directory API request, no pagination.
Use this — not suspended_accounts — whenever the address is known.
That tool lists only accounts that ARE suspended, so it can never confirm
that a given address is not suspended, and once that list exceeds its
page cap absence stops being evidence either way — after spending far more
API calls than this. suspended_accounts is for the domain-wide sweep it
is actually named for.
This directory is downstream of the identity provider, not the master. Read
the answer as "what Google Workspace currently believes about this account"
and compare it against the IdP's own record, which is authoritative for who
the account is. A disagreement is usually drift on this side rather than a
mistyped address — an account the IdP still authenticates can be suspended
or archived here, and an address the IdP does not assert at all will simply
come back found: false.
An address that names no account returns found: false with no state
fields. That is a normal, expected answer — a typo'd or long-deleted
address — and is itself the diagnostic result, NOT a failure. A missing
DWD scope, a rejected credential or a transient API failure is reported as
{"error": ...} instead. The two are deliberately distinct: never read
found: false as "the lookup did not work", and never read an error
as evidence about whether the account exists.
Read-only (Directory API users().get; this tool never changes the
account). Requires the admin.directory.user.readonly DWD scope —
the same one suspended_accounts uses, so a tenant already running that
tool needs no additional grant.
Args:
username: Exact user email, passed through as the Directory API
userKey (primary or alias address both work on Google's side;
the returned email is the account's canonical primary one).
domain: Configured [domain.*] section to route the lookup through.
Default: resolved from the username's suffix. Set it explicitly
when the address uses an alias/secondary domain that has no
config section of its own (common when copying addresses from
mail headers or IdP logs).
Inputs: username (required), domain.
gmail_message_traceA
Check whether a message (by RFC 822 Message-ID) reached specific users' mailboxes.
Answers "who got this email and who didn't" for a KNOWN Message-ID and a KNOWN candidate recipient list — there is no Workspace API to search across every user for one message, so the caller supplies who to check (a mailing-list roster, or simply the people who reported a problem). For each recipient this impersonates that exact user via domain-wide delegation and searches their own mailbox (including Spam and Trash) for the Message-ID.
Requires the gmail.readonly DWD scope — granted PER SERVICE ACCOUNT
CLIENT ID in the Admin console (Security > API controls > Domain-wide
delegation), separately from the admin.directory.* / admin.reports.*
scopes the rest of this server uses, and NOT on by default. A domain
missing that grant reports a per-recipient error rather than a
silent "not found" — the two must never be confused, since "not found"
here can also legitimately mean the message was delivered and later
deleted by the user, or never delivered at all; this tool cannot tell
those apart, only "a match currently exists in this mailbox" from "it
doesn't".
Read-only: only messages().list and messages().get (metadata
only, never the message body) are issued against each impersonated
mailbox — see DomainClient.find_message_by_id.
A per-recipient result sets ambiguous: true (with match_count)
when more than one message in that mailbox shares the Message-ID (e.g. a
mailing-list copy plus a direct CC) — the other fields describe only the
first match in that case, not a combined answer. match_count_capped
is set alongside it when the mailbox has enough matches that
match_count itself is a lower bound, not exact.
Args:
message_id: The RFC 822 Message-ID to search for, with or without
angle brackets. Must be shaped like an address (local@domain,
no whitespace) — this is validated before use, since it is
interpolated into a Gmail search query.
recipients: Comma- and/or whitespace-separated exact recipient email
addresses to check (max 50 per call — split a larger list across
multiple calls rather than expecting a partial result).
domain: Configured [domain.*] section to route EVERY recipient
through. Default: resolved per-recipient from their own address
suffix, so one call can cover a mixed staff/student list. Set
this only when recipients use an alias/secondary domain with no
config section of its own.
Inputs: message_id (required), recipients (required), domain.
gmail_usage_reportA
Daily Gmail send/receive counts per domain (Admin SDK customerUsageReports).
Answers "how much Gmail traffic did this domain send/receive on day X" --
a customer-level daily counter, NOT a per-user or per-message breakdown
(the Reports API has no such thing; login_audit's activity stream is
the per-event alternative for that, at the cost of no volume total).
Each day's fetch is independent: a domain missing the DWD scope reports
one whole-domain error (there is no point retrying days times for
an identical scope failure), but a single date's fetch failing for some
other reason (Google's processing for that day not finished yet is a
known lag on this API family; a transient error) only skips that one
date, recorded in date_errors -- the rest of the window still comes
back. The per-domain result also carries capped -- true if ANY
date's fetch hit the (rare, since a single day's customer report is
normally one record) pagination limit -- so a truncated day's counters
are never mistaken for the complete picture.
Requires the admin.reports.usage.readonly DWD scope, granted PER
SERVICE ACCOUNT CLIENT ID in the Admin console (Security > API controls >
Domain-wide delegation) -- a DIFFERENT scope from
admin.reports.audit.readonly (the one login_audit,
drive_external_sharing, drive_doc_activity,
shared_drive_membership_changes and daily_brief use), even though
both live under the same Admin SDK Reports API. Having one does not
imply the other; grant this one separately.
Read-only: only customerUsageReports().get() is issued, restricted to
the two Gmail counters this tool reports via the API's own parameters
filter (:data:GMAIL_USAGE_PARAMETERS) rather than pulling every
application's counters.
Args:
days: How many days back to report, ending YESTERDAY (not today --
the current day's data is not final until it ends) in the
Reports API's own UTC-8:00/Pacific-Standard-Time date anchor.
Must be 1..:data:MAX_USAGE_REPORT_DAYS -- 0/negative
would otherwise silently return a well-formed, error-free empty
result indistinguishable from "queried correctly, zero Gmail
traffic that window", and an unbounded value drives an unbounded
(domain x date) fan-out (one blocking API call per task, even
though they run concurrently).
domain: Configured [domain.*] section to report on. Default: all
configured domains.
Inputs: days, domain.
group_delivery_policyA
Check a Google Group's own posting/delivery policy — why an external sender's mail never arrived.
A Group's access-control layer sits IN FRONT of Gmail delivery: when
who_can_post is restricted (e.g. domain-members-only), an external
sender's message is rejected there and never generates a per-recipient
Gmail delivery event at all — gmail_message_trace (a real mailbox) and
any Reports-API-based delivery trace both see nothing for that address,
indistinguishable from a genuine delivery failure without this. Use this
FIRST when a group address "isn't receiving" mail from an external
sender, before chasing it as a transport/spam problem.
Read-only: only groups().get() is issued (Groups Settings API).
Requires the apps.groups.settings DWD scope — granted PER SERVICE
ACCOUNT CLIENT ID in the Admin console (Security > API controls >
Domain-wide delegation), separately from every other scope this server
uses, and NOT on by default.
Returns who_can_post (e.g. ALL_IN_DOMAIN_CAN_POST blocks external
senders entirely; ANYONE_CAN_POST allows them), allow_external_members,
is_archived, message_moderation_level, spam_moderation_level,
allow_web_posting. Sets found: false (no policy fields) when
group_email does not name any group in this domain — that is a
normal, expected answer for a bad/typo'd address, not an error.
Args:
group_email: The group's address (e.g. "team.gen@example.edu").
domain: Configured [domain.*] section to route the lookup through.
Default: resolved from the address's suffix.
Inputs: group_email (required), domain.
health_checkA
Report service status, version, and per-domain auth/API reachability.
Always returns the same keys: status (healthy / degraded / error), service,
version, config, and domains (per-domain auth result plus gmail:
ok / api_disabled / no_grant / error, with gmail_detail on an
unexpected error -- whether the per-user Gmail tools can work there; it
does not affect status), sites (the optional GWSADM_SITES_INI
table: configured / ranges / error) and geo (the optional
GWSADM_IP2ASN dataset: configured / home_countries / age_days / error /
warning); both are informational and do not affect status. Lightweight: one 1-item login query and one
users.getProfile per domain.
Inputs: no named parameters.
ip_activityA
Every account ONE source address acted as, across applications and domains.
The follow-through after user_activity names an attacker's address:
did the same source get into other accounts? The Reports API filters on
actorIpAddress server-side, so this is one probe per
(domain × application) over the matching events only, not a scan of the
whole tenant's log — and every domain's probes run in one pool, so a
slow domain does not delay another's answer. Per domain it returns the
acting accounts (count, first/last seen, which applications) ordered
by most recent, the posture flags the address triggered (same
definition as user_activity; Google's own verdicts are included here
when they carry the address, since userKey=all sees them), and
per-application accounting. Failed logins from the address appear under
applications.login.events as login_failure — a spray from this
address shows there before it ever succeeds.
Coverage reads as in user_activity: window.start, per-application
capped / error (and the union capped, a failed application
included), and a per-domain error when that domain's credential is
rejected (the other domains still answer). A quiet answer for a
current-day window can be data lag rather than absence.
Read-only (Reports API activities().list only, the
admin.reports.audit.readonly DWD scope).
Args:
ip: The source address, IPv4 or IPv6 literal (no zone id). Validated
before use.
hours: Window length ending now.
applications: Comma-separated application names; default as in
user_activity.
max_pages: Page budget per (domain × application).
top: Accounts returned per domain, most recently seen first;
accounts_total says how many there were.
domain: Restrict to one configured [domain.*] section. Default:
every configured domain, since an address is not tied to one.
Inputs: ip (required), top, hours, domain, +2 more.
list_group_membersA
List a Google Group's basic metadata and member roster (Directory API).
Resolves a group's actual membership directly, independent of any
specific message ever having been sent to it — unlike inferring
membership from Reports API delivery-event fanout (applicationName=gmail),
which only shows members who received one PARTICULAR message and
requires one to already exist to trace. Pair with gmail_message_trace
to deep-dive a specific member's mailbox once the roster is known, or
with group_delivery_policy to see why the group as a whole may not be
receiving mail at all.
Read-only: only groups().get() and members().list() are issued
(Directory API), never a mutating call. Requires the
admin.directory.group.readonly and
admin.directory.group.member.readonly DWD scopes — granted PER
SERVICE ACCOUNT CLIENT ID in the Admin console, separately from every
other scope this server uses, and NOT on by default. The two calls are
independent: a tenant with only one of the two scopes granted still gets
that one section, with the other reported as {"error": ...} in its
place rather than failing the whole call — only when BOTH fail does the
tool return a single top-level error.
Sets found: false (no group/members sections) when
group_email does not name any group in this domain — a normal,
expected answer for a bad/typo'd address, not an error. This
triggers both when BOTH calls agree with no error on either side, AND
when one call CONFIRMS not-found while the other independently failed
(its own error is then attached as group_lookup_error /
members_lookup_error) — a confirmed non-existence from one
independently-scoped call is stronger evidence than an unrelated
failure on the other, and must not be buried under it.
Args:
group_email: The group's address.
domain: Configured [domain.*] section to route the lookup through.
Default: resolved from the address's suffix.
max_pages: Pagination cap for the member roster (Directory API hard
limit 200 members per page). Default 20 (≤4,000 members) —
raise for an unusually large group. capped: true means the
roster is NOT the complete one — either more pages existed
beyond this, or the member lookup failed outright (see
members_error); either way it must never be read as the
full membership, and an empty members list must not be
mistaken for a confirmed-empty group when capped is true.
Inputs: group_email (required), domain, max_pages.
login_auditA
Audit the login log: Google-auto-disabled accounts, suspicious logins, failure top-N.
Answers "did Google itself decide something was wrong with an account here,
and with which account?" — the question a "my mail suddenly stopped working"
ticket usually turns out to be. account_disabled_* is Google reporting
that it locked an account (leaked password, hijacking, spamming);
suspicious_login and gov_attack_warning are warnings without a lock.
In both sections user is the account the event is ABOUT, not an actor
who did something: Google raised these itself, so the actor is Google and
the account is read from the event's affected_email_address. Treat a
hit as evidence about that account, and reach for get_user next for its
current state.
An account_disabled_spamming entry means Google observed outbound spam,
which is a compromise finding, not a delivery problem — the account was
almost certainly being used by someone else. The IdP upstream is a separate
system and is NOT disabled by this: an account locked here can still
authenticate there until it is disabled there too.
Combine with a Directory suspended-users snapshot (Phase 2) for current
state. Each section carries capped (window not fully scanned) — treat
counts as lower bounds then.
Inputs: top, hours, domain, include_failures.
suspended_accountsA
Snapshot of currently suspended Google Workspace accounts, per domain.
A suspended-but-still-provisioned account is a common attack surface: an account disabled in Google may remain enabled in a downstream IdP (e.g. KeyCloak), where a password-spray attacker can still authenticate through it. Cross-reference this list against the IdP to find and disable such gaps.
Unlike login_audit (which reports the event of Google disabling an
account within a time window), this is current state — every account
suspended right now, regardless of when. Read-only (Directory API
users().list with query=isSuspended=true). Requires the
admin.directory.user.readonly DWD scope; a domain missing that grant
degrades to {"error": ...} for that domain only. capped is set when
max_pages was hit before the listing was exhausted.
Coverage is per configured domain (Directory domain= filter), unlike the
customer-wide Reports tools — every domain you want covered (e.g. a separate
student domain) must have its own [domain.*] config section, or its
suspended accounts are not listed.
Args:
domain: Restrict to one configured domain (default: all).
max_pages: Page cap (500 accounts/page); capped=true means more exist.
Inputs: domain, max_pages.
user_activityA
Everything ONE account did across Workspace in a window, newest first.
The first question after an upstream identity provider reports an account
as compromised: did the attacker get into Google, and what did they do
there? login_audit cannot answer it — it is a domain-wide view of the
events Google itself raised, so it shows neither one named account's
logins nor the logins Google did not flag. This tool asks the Reports API
for that one account (userKey=<username>, server-side) across several
applications at once and merges the answers.
Read flags first. It holds the events that change the account's
security posture or mark it as under attack, regardless of how much
ordinary activity surrounds them: a second factor enrolled or disabled
(2sv_enroll survives a password reset — it is the attacker's way back
in), recovery email/phone changes, a password change, outbound mail
forwarding to another domain, Google's own risky_sensitive_action_*
verdicts, a login Google marked is_suspicious, and every OAuth
authorize (client and scopes — note that a service account
impersonating the user through domain-wide delegation, this server's own
Gmail tools included, appears here too, as an authorize whose
client_id is the service account's numeric id). Google's
account_disabled_* / suspicious_login / gov_attack_warning
verdicts are flags too, but they are NOT served under the account's own
userKey (their actor is Google), so they are fetched separately the
way login_audit does and reported under the synthetic application
login_verdicts — its event_errors names any verdict probe that
failed. ips lists the distinct source addresses with first/last seen
and which applications each touched — the input to ip_activity for
the "did the same source reach other accounts" question. timeline is
the merged event list (Drive read/edit/download noise is counted under
applications.drive.events but kept off the timeline), cut at
max_events with timeline_truncated saying so. Counts on
applications, ips and the timeline are raw deliveries: an event
the API delivers under two applications counts twice there and once in
flags.
Coverage is explicit: window.start is the time actually asked for,
each application reports its own capped (more pages existed) or
error (that application failed — the others still answer), and
capped at the top is their union, a failed application included.
Reports data for the current day can lag by hours, so an empty window
right after an incident is "not visible yet", not "nothing happened". A
missing DWD scope or a rejected credential is a whole-call
{"error": ...}.
Read-only (Reports API activities().list only, the same
admin.reports.audit.readonly DWD scope as login_audit).
Args:
username: Exact user email, passed through as the Reports API
userKey (primary or alias address both work on Google's side).
hours: Window length ending now.
applications: Comma-separated Reports API application names to walk.
Default: login, token, user_accounts, drive, groups, calendar,
chat, meet, saml. gmail is deliberately not in the default —
not every tenant has it — pass it explicitly where it exists.
max_pages: Page budget per application (1000 events per page). The
verdict probes use their own small budget (VERDICT_MAX_PAGES).
max_events: Timeline rows returned (newest first); flags, ips and
counts are computed over everything fetched regardless.
domain: Configured [domain.*] section to route the lookup
through. Default: resolved from the username's suffix.
Inputs: username (required), hours, domain, max_pages, +2 more.
user_oauth_tokensA
List third-party OAuth apps one user has granted account access to.
Account-compromise triage tool for the case login_audit and
suspended_accounts are both blind to: a malicious app used a
previously-granted OAuth token to read/delete mail or Drive files without
ever generating a fresh login event. Check each entry's scopes for
Gmail/Drive access on an unrecognized client_id/display_text —
Google's own apps (e.g. iOS/Android account sync) show up too and are
normal noise.
Read-only (Directory API tokens().list; never tokens().delete()).
Requires the admin.directory.user.security DWD scope — distinct from
admin.directory.user.readonly used by suspended_accounts; a domain
missing that grant returns {"error": ...}. No pagination: the API
returns a user's full grant list in one response.
Args:
username: Exact user email, passed through as the Directory API
userKey (primary or alias address both work on Google's side).
domain: Configured [domain.*] section to route the lookup through.
Default: resolved from the username's suffix. Set it explicitly
when the address uses an alias/secondary domain that has no
config section of its own (common when copying addresses from
mail headers or IdP logs).
Inputs: username (required), domain.
workspace_statusA
Is a Google Workspace service down? Open and recent incidents from Google's status dashboard.
Reads the public Google Workspace Status Dashboard feed (no credential,
no DWD scope): the incidents Google has declared for Gmail, Drive, Meet,
Calendar, Chat and the other Workspace products. open lists the
incidents not yet resolved; recent those that ended within the last
hours. Each row: service, affected_products, severity,
status_impact, begin / end (UTC), summary (the latest
update's summary line), last_update and the incident's url.
The dashboard is global: an empty answer means Google has declared no
incident, not that this tenant cannot be affected, and a local problem
(a network path, one account) never appears here.
Args:
hours: How far back recent reaches (at most 2160, 90 days).
service: Keep incidents whose service or affected product name
contains this text (case-insensitive), e.g. Gmail.
Inputs: hours, service.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 21 tools
Most tools map to clearly distinct resources/actions, and the descriptions explicitly disambiguate confusing pairs (get_user vs suspended_accounts, login_audit vs suspended_accounts vs user_activity, group_delivery_policy vs gmail_message_trace). The only real overlap is between the composite tools (compromise_sweep, daily_brief) and the primitive tools they bundle, plus the daily_brief / daily_brief_start / daily_brief_result trio, where an agent must choose between a sync call and an async job.
All names are snake_case and readable, with a consistent resource-first/report-name style (user_activity, ip_activity, login_audit, drive_external_sharing). Minor deviation: a couple use verb_noun (get_user, list_group_members) while most are noun phrases, but the style never becomes confusing.
21 tools is at the upper edge but justified by the genuinely broad domain: directory, Reports API audits, Drive sharing, Gmail trace/usage, groups, DMARC, status dashboard, plus a sync/async pair. Each tool earns its place; only the daily_brief trio feels like a small inflation.
Covers read-side lifecycle well: user state, suspended accounts, tokens, activity, IP pivots, admin audit, Drive sharing and doc history, group membership and posting policy, DMARC, and Gmail delivery trace/usage. Gaps are deliberate (read-only, no remediation) but notable: Gmail forwarding/filter settings are only reachable through compromise_sweep, and there is no standalone per-user Gmail usage or group settings beyond posting policy.
Maintenance
Related MCP Connectors
Hosted MCP server for GA4, Google Ads and Search Console. Google OAuth, nothing to install.
Hosted MCP for Google Workspace, Atlassian and Notion: one OAuth, per-user accounts, write access.
Hosted Google Search Console MCP server, with each action switched on or off per account.
Paid remote MCP for AI Studio Workspace approval gate MCP, structured receipts, audit logs, and revi
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server for Google Workspace APIs - Docs, Sheets, Drive, Gmail, and Calendar. Enables reading, creating, and editing Google Docs and Sheets, managing comments, reading emails, and viewing calendar events.3422 npm17MIT
- AlicenseBqualityDmaintenanceProduction-ready MCP server for Google Workspace providing broad coverage across Gmail, Drive, Calendar, Docs, Sheets, and more, with safe-by-default write operations and markdown-to-Google-Docs support.100MIT
- FlicenseBqualityDmaintenanceMCP server providing full access to Google Workspace services (Gmail, Drive, Calendar, Docs, Sheets, Slides, Forms, Tasks, Contacts) using OAuth authentication.1001-
- FlicenseNot gradedqualityCmaintenanceRead-only MCP server for Microsoft Entra ID (Azure AD) that enables querying user sign-in logs, group memberships, and assigned Microsoft 365 licenses via Microsoft Graph API. Provides security and audit visibility without any write operations.-