# Insert Person — Google Docs

> Insert a person smart chip (an @-mention) for an email address into a Google Doc: a real people chip with a hover card, not plain text. Use it whenever someone should be mentioned or tagged in a doc: owners, assignees, attendees…

- Key: `google_docs-insert-person`
- Type: Action (Write)
- Version: 0.1.0
- App: Google Docs (`google_docs`) — https://pipedream.com/apps/google-docs.md
- This page (HTML): https://pipedream.com/apps/google-docs/actions/insert-person
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/google_docs/actions/insert-person/insert-person.mjs

## Description

Insert a person smart chip (an @-mention) for an email address into a Google Doc: a real people chip with a hover card, not plain text. Use it whenever someone should be mentioned or tagged in a doc: owners, assignees, attendees, reviewers. Google shows the person's name when it can resolve the account; otherwise the chip shows the email address. Mentioning someone does not share the document with them. Place the chip with **Placeholder** (replace text such as `{{owner}}` that you wrote with **Insert Text**) or with **Position**; in a multi-tab document either set **Tab ID** (from **List Tabs**) or use **Placeholder**. Use **Find Document** to resolve a document's name to its ID. Example: after inserting `Owner: {{owner}}`, call with documentId=`1AbC...`, email=`alan.grant@example.com`, placeholder=`{{owner}}` -> returns `chipsInserted`, each chip's `tabId` and `index`, and the document `url`. [See the documentation](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#InsertPersonRequest)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `documentId` | `string` | Yes | The ID of the Google Doc. This is the long string in the document's URL: https://docs.google.com/document/d/{DOCUMENT_ID}/edit. Use Find Document to resolve a document's name to its ID. |
| `email` | `string` | Yes | Email address of the person to mention, e.g. alan.grant@example.com. Google shows the person's name when it can resolve the account, otherwise the email; a name cannot be supplied. |
| `placeholder` | `string` | No | Existing text to replace with the chip, matched exactly (case-sensitive). Typically a placeholder you wrote with Insert Text, such as {{owner}}, or a name already in the document. Searches every tab unless Tab ID is set. When set, Position is ignored. This is the reliable way to put a chip mid-sentence: no character index needed. |
| `occurrence` | `string` | No | Which matches of Placeholder become chips: all (default) or first. |
| `position` | `string` | No | Where to insert the chip when no Placeholder is given: end to append to the end of the tab (default), beginning, or a numeric character index (e.g. 12) from Get Document. The chip joins the paragraph at that point, so to start a new line insert a newline with Insert Text first. |
| `tabId` | `string` | No | For a multi-tab document, the ID of the tab to insert into (e.g. t.0); get IDs from List Tabs, or use the ID returned by Create Tab. Required when the document has more than one tab and the chip is placed by Position: the tool will not guess, so a chip never lands in the first tab by accident. With Placeholder, omit it to search every tab. |
| `suggestMode` | `boolean` | No | Make the change as a suggestion (Google Docs Suggesting mode) that the document's editors can accept or reject, instead of editing the document directly. The response's suggestionIds lists the suggestions the change created or extended - an edit next to an existing suggestion can join it rather than create a new one. Pass the IDs to Resolve Suggestions, or use List Suggestions to see every open suggestion. While a suggestion is open, the document text this returns shows the suggested and the original text side by side. Set true to propose the edit, or leave false (default) to edit directly. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "google_docs",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "google_docs-insert-person",
  arguments: {
    documentId: "Document ID",
    email: "Email",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "google_docs-insert-person",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    google_docs: { authProvisionId: "apn_xxxxxxx" },
    documentId: "Document ID",
    email: "Email",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "google_docs-insert-person",
    "configured_props": {
      "google_docs": { "authProvisionId": "apn_xxxxxxx" },
      "documentId": "Document ID",
      "email": "Email"
    }
  }'
```

---

- App: https://pipedream.com/apps/google-docs.md · All apps: https://pipedream.com/apps
