Skip to main content
Glama
shigechika

gwsadm-mcp

by shigechika

user_activity

Audit one Google Workspace account across apps to see what an attacker did after compromise, surfacing security flags, OAuth grants, source IPs, and a merged activity timeline.

Instructions

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.

Input Schema

NameRequiredDescriptionDefault
hoursNo
domainNo
usernameYes
max_pagesNo
max_eventsNo
applicationsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.22.1

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does: read-only scope (Reports API activities().list, same admin.reports.audit.readonly DWD scope as login_audit), whole-call error vs per-application error semantics, data lag caveat ('not visible yet, not nothing happened'), truncation signaling, and deduplication counting rules. It even flags a non-obvious behavior — that domain-wide delegation impersonation surfaces as an authorize event.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded and well-sectioned — purpose, then what to read first (flags), then the other return keys, then coverage caveats, then args. It is long, and a few parentheticals (2sv_enroll surviving a password reset, service-account client_id details) could be tightened, but every block is load-bearing given there is no output schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a six-parameter, no-annotation, no-output-schema forensic tool, nothing an agent needs is missing: return structure (flags, ips, timeline, applications, timeline_truncated), partial-failure behavior, latency caveat, auth requirements, and the intended follow-up tool are all present.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it does for all six parameters: username is passed through as userKey with alias support noted, hours is window length ending now, applications lists the exact default set plus why gmail is excluded, max_pages states the 1000-events-per-page unit, max_events explains that flags/ips/counts are computed over everything fetched regardless, and domain explains the default resolution from username suffix.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource+scope: 'Everything ONE account did across Workspace in a window, newest first.' It explicitly distinguishes itself from the nearest sibling ('login_audit cannot answer it — it is a domain-wide view'), so an agent can route correctly without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Names the triggering situation ('the first question after an upstream identity provider reports an account as compromised') and the exact alternative it replaces and why. It also hands off downstream ('the input to ip_activity for the "did the same source reach other accounts" question'), giving a complete when-to-use / when-to-use-something-else map.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.