Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
docs: clean up gmail labeler prose
Remove em dashes and tighten copy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sushmitha Mallesh committed
Feb 25, 2026 at 18:55 UTC
3f49be59a09b8b55e5201b7581c1b433e94c0ce9
1 file changed
+6
-6
docs/content/cookbooks/gmail-labeler.mdx
+6
-6
@@ -5,7 +5,7 @@ description: Build a Python script that listens for new Gmail messages and label
5
6
[View source on GitHub](https://github.com/ComposioHQ/composio/tree/next/docs/examples/gmail-labeler)
7
8
-This cookbook builds a standalone Python script that connects to Gmail, listens for incoming messages via Composio triggers, and uses Claude to automatically label each email. We'll use **scoped sessions** to limit the agent to Gmail tools only.
8
+This cookbook builds a Python script that connects to Gmail, listens for new messages using Composio triggers, and uses Claude to label each email automatically. The agent is scoped to Gmail tools only using a **scoped session**.
9
10
## Prerequisites
11
@@ -38,19 +38,19 @@ ANTHROPIC_API_KEY=your_anthropic_api_key
38
39
## Connecting to Gmail
40
41
-Before labeling, we need to make sure the user has connected their Gmail account. The `connect` function creates a scoped session with `toolkits=["gmail"]` and checks the connection status via `session.toolkits()`. If Gmail is not connected, `session.authorize("gmail")` starts the OAuth flow and returns a URL for the user to visit. `wait_for_connection()` blocks until they complete it.
41
+Before labeling emails, the user needs to connect their Gmail account. The `connect` function creates a scoped session with `toolkits=["gmail"]` and checks the connection status with `session.toolkits()`. If Gmail is not connected, `session.authorize("gmail")` starts the OAuth flow and returns a URL for the user to visit. `wait_for_connection()` blocks until they complete it.
42
43
<include>../../examples/gmail-labeler/main.py#connect</include>
44
45
## Labeling with Claude
46
47
-For each incoming email, `label_email` gets Gmail tools from `session.tools()`, wraps them in an MCP server with `create_sdk_mcp_server()`, and hands them to a Claude agent. The agent lists existing labels, picks the best fit (or creates a new one), and applies it.
47
+For each incoming email, `label_email` fetches Gmail tools from `session.tools()`, wraps them in an MCP server using `create_sdk_mcp_server()`, and passes them to a Claude agent. The agent lists existing labels, picks the best fit or creates a new one, and applies it to the email.
48
49
<include>../../examples/gmail-labeler/main.py#label</include>
50
51
## Listening for emails
52
53
-The `listen` function creates a trigger for new Gmail messages and subscribes to events via WebSocket. When a new email arrives, the handler calls `label_email` to classify and label it.
53
+The `listen` function creates a trigger for new Gmail messages and subscribes to events over WebSocket. When a new email arrives, the handler calls `label_email` to classify and label it.
54
55
<include>../../examples/gmail-labeler/main.py#listen</include>
56
@@ -72,7 +72,7 @@ First, connect your Gmail account:
72
uv run --env-file .env python main.py connect default
73
```
74
75
-If Gmail is not connected yet, you'll get an OAuth URL. Open it in your browser and authorize the app. If you've already connected, the script will print "Gmail is already connected."
75
+If Gmail is not connected yet, you will get an OAuth URL. Open it in your browser and authorize the app. If already connected, the script prints "Gmail is already connected."
76
77
Then start the listener:
78
@@ -80,4 +80,4 @@ Then start the listener:
80
uv run --env-file .env python main.py listen default
81
```
82
83
-Send yourself an email and watch the terminal — the agent will receive the event, inspect the email, and apply an appropriate label.
83
+Send yourself an email and watch the terminal. The agent will receive the event, inspect the email, and apply a label.