Skip to main content
Glama

Remove someone’s access

unshare_doc

Revoke access to a Google Doc after verifying the current role first. Built-in role check ensures safe, intentional removal of sharing permissions.

Instructions

Revoke a grant on a Google Doc. Pass email for a person or a group. A grant with no email — a domain-wide grant, or anyone-with-link — has no email to pass, so address it by permissionId from list_permissions (run that first; it also tells you the role you are about to remove). Refuses to touch the owner. expectRole is REQUIRED — run list_permissions first and echo the role back; a permission change is recorded nowhere and cannot be restored from version history, so this is the only thing standing between a misaimed call and a silent, unrecoverable revocation. Note a doc created under a Workspace domain may carry a domain grant nobody explicitly added.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>",
      "expectRole": "<expectRole>"
    },
    "name": "unshare_doc"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesThe doc: a Drive id or URL, or /folder/doc. A tab path names its doc.
emailNoperson or group to revoke; omit when using permissionId
accountNoGoogle account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account.
expectRoleYesREQUIRED — the grant's current role as list_permissions reported it (reader/commenter/writer). Verified first: if it changed since you looked, nothing is removed. Revoking leaves no record anywhere, so this makes you look before you cut.
expectTitleNothe doc’s title; verified before revoking so a wrong id is refused
permissionIdNoid from list_permissions — the only way to revoke a domain or anyone-with-link grant

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.0.0
    • removedInput schema / properties / documentId
      Removed value: -{
      -  "type": "string"
      -}
    • addedInput schema / properties / path
      Added value: +{
      +  "description": "The doc: a Drive id or URL, or /folder/doc. A tab path names its doc.",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "documentId",
      -  "expectRole"
      -]New value: +[
      +  "path",
      +  "expectRole"
      +]
  2. Changed5 schema fields changedv0.5.0
    • addedInput schema / properties / email / description
      Added value: +"person or group to revoke; omit when using permissionId"
    • addedInput schema / properties / expectRole
      Added value: +{
      +  "description": "REQUIRED — the grant's current role as list_permissions reported it (reader/commenter/writer). Verified first: if it changed since you looked, nothing is removed. Revoking leaves no record anywhere, so this makes you look before you cut.",
      +  "type": "string"
      +}
    • addedInput schema / properties / expectTitle
      Added value: +{
      +  "description": "the doc’s title; verified before revoking so a wrong id is refused",
      +  "type": "string"
      +}
    • addedInput schema / properties / permissionId
      Added value: +{
      +  "description": "id from list_permissions — the only way to revoke a domain or anyone-with-link grant",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "documentId",
      -  "email"
      -]New value: +[
      +  "documentId",
      +  "expectRole"
      +]
  3. First observedv0.1.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 so: it discloses that revocation is unrecorded and unrecoverable from version history, that expectRole/expectTitle act as verified pre-conditions that fail closed, that the owner is protected, and that hidden domain grants may exist to surprise the agent.

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 with the action, then addressing modes, then safety rationale — a sensible order with no filler sentences. It loses a point because the expectRole warning largely restates the schema's own expectRole description, which is mild duplication of structured data.

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 destructive 6-parameter mutation with no annotations and no output schema, the description supplies the pre-conditions, the safety model, the grant-addressing edge cases, and the failure behavior. Nothing material is left for the agent to guess.

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 coverage is 100%, so the baseline is 3, but the description goes beyond it by explaining the email/permissionId routing decision and why expectRole must be echoed from a prior list_permissions call. It adds decision-relevant meaning, not just labels.

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?

The first sentence gives a specific verb and resource ('Revoke a grant on a Google Doc'), which cleanly separates it from the sibling share_doc. The rest of the paragraph clarifies the two addressing modes, so the agent knows exactly what operation is being selected.

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?

It explicitly states when to use `email` versus `permissionId`, mandates list_permissions first for both the id and the role, and calls out the owner-refusal boundary. That is a full when/when-not/prerequisite statement rather than an implied one.

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