Gmail MCP Server
Gmail MCP 服务器
一个专为 Gmail 集成而构建的模型上下文协议(MCP)服务器,允许 AI 助手查看未读邮件并执行邮件管理操作。
功能特性
列出未读邮件:从 Gmail 收件箱中检索未读邮件,支持可选的主题过滤
列出所有邮件:从 Gmail 中检索所有邮件(默认为收件箱,可选择所有邮件)
搜索邮件:使用完整的 Gmail 查询语法搜索邮件(
from:、to:、subject:、has:attachment、after:、label:、is:starred)邮件内容:访问完整的邮件内容,包括邮件头、正文和元数据
删除邮件:按 ID 永久删除邮件
归档邮件:按 ID 归档邮件(从收件箱中移除)
Web 仪表盘:美观、响应式的智能收件箱管理仪表盘
自动分诊:每 15 分钟自动进行邮件分类和整理
自动清理:智能删除琐碎邮件并归档日历邀请
Related MCP server: Gmail MCP Server
安装
克隆此仓库:
git clone <repository-url>
cd gmail-mcp-server设置 Google OAuth 2.0 凭据:
创建新项目或选择现有项目
启用 Gmail API
创建 OAuth 2.0 凭据(桌面应用)
下载凭据 JSON 文件并保存为项目根目录下的
credentials.json
进行身份验证(参见下文身份验证):
make auth无需单独的安装步骤——make auth(以及其他所有需要 Python 依赖的 make 目标,如 test、lint、dashboard)会在首次运行时自动创建本地 .venv/ 并将项目安装到其中。你永远不需要在系统范围内 pip install 任何东西(许多发行版自带的系统 Python 是"外部管理"的,会拒绝直接 pip install)。
启动服务器:
.venv/bin/python -m gmail_mcp_server.serverWeb 仪表盘与收件箱管理
Gmail MCP 服务器包含一个功能强大的基于 Web 的仪表盘,用于智能收件箱管理,支持自动分诊和整理。
快速开始
使用以下命令启动仪表盘:
make dashboard或手动启动:
.venv/bin/python app.py仪表盘将在 http://localhost:5000 上可用
仪表盘功能
每 15 分钟自动分诊:自动对邮件进行分类和整理
智能整理:按优先级对邮件分组(重要 → 紧急 → 信息)
自动清理:自动删除琐碎的字段变更并归档日历邀请
实时统计:查看邮件总数、上次同步时间和下次同步倒计时
快速导航:点击邮件分组以预览 Gmail 搜索结果
响应式设计:适用于桌面端、平板和移动设备
手动刷新:使用刷新按钮立即触发分诊
与 Claude Code 配合使用
使用 Claude Code 时,你可以利用此 Gmail MCP 服务器直接从开发环境中管理邮件:
收件箱分诊:使用
/triage命令自动整理和清理收件箱工作流集成:Claude Code 可以帮助分析邮件内容并建议操作
自动化管理:设置仪表盘在后台运行,在你编码时管理邮件
便捷访问:无需离开 IDE 即可查看整理后的收件箱
要与 Claude Code 配合使用:
确保 MCP 服务器已在你的
.mcp.json中配置Claude Code 将有权访问 Gmail 工具进行邮件管理
使用自然语言命令管理邮件(例如"删除这些垃圾邮件"、"归档日历邀请")
有关仪表盘的完整文档,请参阅 DASHBOARD.md。
MCP 配置
要将此 Gmail MCP 服务器与 Claude 或 gemini-cli 配合使用,你需要配置一个 .mcp.json 文件。该文件告诉 AI 助手如何连接到你的 MCP 服务器。
.mcp.json 配置
在你的主目录或项目目录中创建一个 .mcp.json 文件,配置如下:
{
"mcpServers": {
"gmail": {
"command": "/path/to/gmail-mcp-server/.venv/bin/python3",
"args": ["-m", "gmail_mcp_server.server"],
"cwd": "/path/to/gmail-mcp-server"
}
}
}配置说明:
command:要使用的 Python 解释器。将其指向.venv/bin/python3(由make auth自动创建),以便服务器能够访问其已安装的依赖——裸的python/python3会因ModuleNotFoundError而失败,除非这些包恰好已安装在系统范围内。args:传递给 Gmail MCP 服务器模块的参数cwd:Gmail MCP 服务器安装所在的工作目录
对于 Claude Desktop:
将 .mcp.json 文件放在你的 Claude Desktop 配置目录中:
macOS:
~/Library/Application Support/Claude/Windows:
%APPDATA%\Claude\Linux:
~/.config/claude/
对于 gemini-cli:
将 .mcp.json 文件放在你的主目录中,或在运行 gemini-cli 时指定路径。
使用示例
配置完成后,你可以通过客户端配置将 Gmail MCP 服务器与 AI 助手配合使用。
仪表盘 PIN 安全保护
仪表盘可以使用 4 位 PIN 码进行保护。配置后,仪表盘会在每个新会话中显示 PIN 输入界面(会话持续 4 小时)。
设置 PIN
make set-pin
# Enter new PIN: ****
# Confirm PIN: ****
# PIN saved.或直接使用 Python CLI:
python3 app.py --set-pin这会将 PBKDF2-SHA256 哈希后的 PIN 写入项目根目录下的 .pincode。原始 PIN 永远不会被存储。.pincode 和 .flask_secret 均已被 gitignore。
要移除 PIN 保护,请删除 .pincode:
rm .pincode在 Kubernetes 中运行
所有密钥都集中在一个 gmail-mcp-secrets Kubernetes Secret 中(参见 k8s/secret.yaml_example)。使用 PIN 保护时,请将预哈希的 .pincode 值放在其中,而不是在磁盘上生成。
1. 在本地生成 PIN 哈希:
make set-pin # writes .pincode to repo root
cat .pincode # copy the "salt:hash" string或直接生成:
python3 -c "
import secrets, hashlib
pin = '1234' # replace with your PIN
salt = secrets.token_hex(16)
h = hashlib.pbkdf2_hmac('sha256', pin.encode(), salt.encode(), 260000).hex()
print(f'{salt}:{h}')
"2. 将其添加到你的 k8s/secret.yaml 中(与其他密钥一起):
stringData:
.pincode: "salt:hash-from-above"
FLASK_SECRET_KEY: "$(python3 -c 'import secrets; print(secrets.token_hex(32))')"
# ... other fields from k8s/secret.yaml_example3. 应用并部署:
kubectl apply -f k8s/secret.yaml
kubectl apply -f k8s/deployment.yaml入口点会在启动时将 .pincode 从只读的 /secrets/ 挂载点复制到 /app/。FLASK_SECRET_KEY 作为环境变量注入,以确保会话在 Pod 重启后保持稳定。
Make 命令
使用附带的 Makefile 快速访问常见任务:
# Display available commands
make help
# Initialize Gmail OAuth authentication (requires credentials.json)
make auth
# Set or change the dashboard PIN
make set-pin
# Start the web dashboard
make dashboard
# Stop the running dashboard
make kill-dashboard
# Run inbox triage once (email classification and organization)
make triage
# Watch inbox every 10 minutes (runs triage repeatedly)
make watch你可以使用 MODEL 变量指定要使用的 Claude 模型:
make triage MODEL=haiku # Fast triage with Haiku (default)
make triage MODEL=sonnet # Balanced triage with Sonnet
make triage MODEL=opus # Most capable triage with Opus
make watch MODEL=opus可用工具
1. list_unread_emails
列出 Gmail 收件箱中的未读邮件,支持可选过滤。重建用于删除/归档/修改工具的内存位置映射。
参数:
subject_filter(可选):按主题文本过滤邮件max_results(可选):要返回的最大邮件数(默认:50)
2. list_all_emails
列出 Gmail 中的邮件(默认为收件箱,包括已读和未读邮件)。重建内存位置映射。
参数:
inbox_only(可选):是否仅列出当前在收件箱中的邮件(默认:true)。设置为false可列出所有文件夹中的所有邮件。max_results(可选):要返回的最大邮件数(默认:50)
3. search_emails
使用标准 Gmail 搜索查询语法搜索邮件。重建内存位置映射。
参数:
query(必填):Gmail 搜索查询字符串(例如from:user@example.com、has:attachment、subject:report、after:2024/01/01、is:starred、label:work)max_results(可选):要返回的最大邮件数(默认:50)
4. delete_emails
将邮件移至垃圾桶并将其标记为已读。接受上次邮件列表/搜索调用中的位置编号和/或显式的 Gmail 消息 ID。
参数:
positions(可选):邮件列表中的 1 基位置编号数组message_ids(可选):Gmail 消息 ID 数组
5. archive_emails
归档邮件(从收件箱中移除)并将其标记为已读。
参数:
positions(可选):1 基位置编号数组message_ids(可选):Gmail 消息 ID 数组
6. list_labels
返回所有 Gmail 标签(系统标签 + 用户自定义标签)。
参数: 无
7. create_label
创建新的 Gmail 标签,支持可选颜色。
参数:
name(必填):标签名称(例如Triage/Security)background_color(可选):十六进制颜色(例如#4a86e8)——必须是预定义的 Gmail 颜色text_color(可选):十六进制文本颜色——必须与background_color配对使用
8. modify_labels
在邮件上添加和/或移除标签。添加 Triage/* 标签时,邮件上的所有其他 Triage/* 标签会被自动移除(每封邮件仅一个标签的不变规则)。
参数:
positions(可选):1 基位置编号数组message_ids(可选):Gmail 消息 ID 数组add_labels(可选):要添加的标签名称数组remove_labels(可选):要移除的标签名称数组
9. list_recent_actions
返回最近的邮件操作的内存日志(上限为 100 条)。
参数:
limit(可选):要返回的最大操作数(默认:10)
身份验证
初始设置
首次运行时,服务器需要身份验证。使用提供的身份验证辅助工具:
make auth这会在运行身份验证流程之前自动创建 .venv(如果尚不存在)并将依赖安装到其中,因此无需手动执行 pip install 步骤。
或使用项目的虚拟环境手动操作:
.venv/bin/python -m gmail_mcp_server.auth这将:
检查项目根目录下是否存在
credentials.json打开浏览器窗口进行 OAuth 2.0 身份验证
请求访问你的 Gmail 账户的权限
将身份验证令牌保存到
token.json以供将来使用
获取凭据
在运行 make auth 之前,你需要设置 Google OAuth 2.0 凭据:
创建新项目或选择现有项目
启用 Gmail API
创建 OAuth 2.0 凭据(桌面应用)
下载凭据 JSON 文件并保存为项目根目录下的
credentials.json
工作原理
服务器在启动时检查是否已有身份验证令牌(
token.json)如果令牌存在且有效,服务器会自动使用它
如果令牌已过期但有刷新令牌,服务器会自动刷新
如果不存在令牌,服务器将要求使用
make auth命令进行身份验证
所需的 Gmail API 范围
https://www.googleapis.com/auth/gmail.readonly- 读取邮件https://www.googleapis.com/auth/gmail.modify- 删除和归档邮件
安全说明
确保你的
credentials.json和token.json文件安全这些文件会被 git 自动忽略
服务器仅请求最低限度的必要权限
所有操作均通过官方 Gmail API 执行
开发
make test、make lint、make format 和 make auth 都会在首次运行时自动创建 .venv/(包含开发依赖),因此无需单独的设置步骤。
运行测试:
make test # run all tests
make test-cov # run with coverage report代码检查与格式化:
make lint # check with ruff
make format # auto-format and fix imports with ruff直接运行 MCP 服务器:
.venv/bin/python -m gmail_mcp_server # short form (via __main__.py)
.venv/bin/python -m gmail_mcp_server.server # explicit
.venv/bin/gmail-mcp-server # installed entry point使用 MCP Inspector 交互式测试服务器:
npx @modelcontextprotocol/inspector .venv/bin/python3 -m gmail_mcp_server.serverAvailable Tools
7 toolsarchive_emailsA
Archive emails (remove from inbox). Accepts positions[] from email list and/or message_ids[].
| Name | Required | Description | Default |
|---|---|---|---|
| positions | No | Position numbers from the email list | |
| message_ids | No | Gmail message IDs |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description bears full responsibility. It states the tool removes emails from inbox but does not disclose whether the action is reversible, permission requirements, or potential side effects (e.g., label changes). For a mutation tool, this is insufficient transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single efficient sentence that front-loads the action and then concisely lists the accepted inputs. No extraneous words or repetitions; every phrase earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple tool with two fully described parameters and no output schema, the description covers the essential purpose and input relationship. It could be enhanced by mentioning the return value (e.g., success status or count), but the current level is adequate for most use cases.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% for both parameters, but the description adds value by noting positions come from an email list (linking to sibling tool list_unread_emails) and that positions and message_ids are alternatives. This contextual information enhances the schema's basic definitions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action (archive emails) and the resource (remove from inbox), and it distinguishes from siblings like delete_emails by specifying it only removes from inbox. It also explicitly mentions the two input methods, making the purpose unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for moving emails out of inbox but does not explicitly state when to use this tool vs alternatives like delete_emails or modify_labels. No exclusions or prerequisites are provided, leaving the agent to infer usage context from sibling names.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
create_labelC
Create a new Gmail label
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The label name to create | |
| text_color | No | Hex text color (e.g. '#ffffff'). Must be used with background_color. Only predefined Gmail colors are accepted. | |
| background_color | No | Hex background color (e.g. '#4a86e8'). Must be used with text_color. Only predefined Gmail colors are accepted. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description bears full responsibility for behavioral disclosure. It merely states the action without revealing what happens upon success or failure (e.g., duplicate label behavior, color validation, return value). This is a significant gap for a creation tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the key action. It could be slightly expanded with usage hints without losing conciseness, but it is not overly verbose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of an output schema and annotations, the description should provide more context about the tool's behavior, such as whether it returns the created label, any side effects, or error conditions. The current text is insufficient for a complete understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema provides 100% description coverage for all three parameters, so the description adds minimal value beyond the schema. It correctly implies that 'name' is the label name, but does not elaborate on color constraints or usage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'Create' and the resource 'Gmail label', making the tool's purpose straightforward. However, it does not explicitly distinguish it from sibling tools like 'modify_labels' or 'list_labels', though the name itself provides some differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives. For example, it does not mention that 'modify_labels' could be used to update existing labels, nor does it specify prerequisites or context for creation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
delete_emailsA
Move emails to trash and mark as read. Accepts positions[] from email list and/or message_ids[].
| Name | Required | Description | Default |
|---|---|---|---|
| positions | No | Position numbers from the email list | |
| message_ids | No | Gmail message IDs |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Without annotations, the description carries the burden of behavioral disclosure. It states the tool moves emails to trash and marks them as read, which are key effects. However, it does not mention whether the action is reversible (e.g., Gmail trash recovery) or any side effects like batch limits.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two short, front-loaded sentences with no unnecessary words. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is simple (delete), and the description covers the core action and parameters. However, it lacks details about return behavior, error handling, or batch limitations, which would be helpful given no output schema or annotations.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the schema already describes both parameters. The description adds value by clarifying that positions[] and message_ids[] can be used 'and/or' together, indicating they are alternative or complementary ways to specify emails.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Move emails to trash and mark as read,' specifying the verb (move/trash, mark) and resource (emails). It distinguishes from sibling tools like archive_emails (which archives rather than trashes) and list_unread_emails (which lists).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies the tool is used to delete emails but does not explicitly state when to use this tool versus alternatives like archive_emails or modify_labels. No when-not-to-use or prerequisite guidance is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_labelsB
List all Gmail labels
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description bears full responsibility for behavioral disclosure. It only states 'List all Gmail labels', but does not confirm it is read-only, describe output format, or mention any rate limits or permissions. For a zero-annotation tool, this is insufficient.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that is front-loaded and contains no unnecessary words. It is concise and to the point.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema, no annotations, and zero parameters, the description is adequate for a simple list operation. However, it does not provide any context about pagination, result format, or relationship to sibling tools like create_label. It is minimally complete but not enriching.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
There are zero parameters, so schema coverage is 100% trivially. The description adds no additional meaning beyond the schema. Baseline for 0 params is 4, but the description is minimal and does not enrich the agent's understanding of the tool's behavior or output.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool lists all Gmail labels, which is a specific verb+resource. It distinguishes from siblings like list_unread_emails (lists emails) and list_recent_actions (actions, not labels). However, it does not explicitly differentiate from create_label or modify_labels, which operate on labels but are different actions.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives. For example, before creating a label with create_label, an agent might need to list existing labels to avoid duplicates, but this is not mentioned. No exclusions or context cues.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_recent_actionsB
Show recent actions taken on emails (delete, archive, label changes, etc.)
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of recent actions to show (default: 20) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It only states the tool shows recent actions, but does not disclose behavioral traits like authentication requirements, action types scope, time range, sorting, or any side effects. Significant lack of transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that is front-loaded with the verb and resource. No filler words; every part serves a purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple list tool with one parameter and no output schema, the description is adequate but not fully complete. It mentions action types, but lacks details on output format, sorting, time range, or pagination. Leaves some ambiguity for the agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with one parameter 'limit' having a default and description. The description adds no additional meaning beyond what the schema provides. Baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('show') and the resource ('recent actions on emails'), with specific examples (delete, archive, label changes). This distinguishes it from sibling tools like list_unread_emails (which shows emails, not actions) and delete/archive tools (which perform actions).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool vs. alternatives. It does not mention when not to use it or provide any conditions. The context from sibling tools only implicitly implies viewing, but no clear usage instructions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_unread_emailsA
List unread emails in Gmail inbox with optional subject filtering
| Name | Required | Description | Default |
|---|---|---|---|
| max_results | No | Maximum number of emails to return (default: 50) | |
| subject_filter | No | Optional filter to search for emails with specific subject content |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description bears the burden of disclosing behavior. It indicates a read operation but does not explicitly state it is read-only, nor does it mention pagination, rate limits, or other behavioral traits. Basic transparency is achieved but gaps remain.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, front-loaded with key information, no wasted words. Perfectly concise and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema, the description should at least hint at what is returned (e.g., email metadata). It fails to mention return format, fields, or behavior on empty results. For a list tool, this is a significant gap.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. The description adds no additional meaning beyond what the schema already provides for each parameter. The mention of 'subject filtering' is redundant with the schema description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'list' and the resource 'unread emails in Gmail inbox' with an optional filter. It distinguishes itself from sibling tools like delete_emails and archive_emails.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for listing unread emails but does not explicitly state when to use this tool versus alternatives (e.g., when to use list_unread_emails vs list_recent_actions). No when-not guidance is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
modify_labelsA
Batch add/remove labels on emails. Accepts positions[] and/or message_ids[], plus add_labels[] and/or remove_labels[] (label names). When adding a Triage/* label, all other Triage/* labels on the email are automatically removed.
| Name | Required | Description | Default |
|---|---|---|---|
| positions | No | Position numbers from the email list | |
| add_labels | No | Label names to add | |
| message_ids | No | Gmail message IDs | |
| remove_labels | No | Label names to remove |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description discloses key behavioral traits: batch operation, parameter flexibility, and the automatic removal of other Triage/* labels when adding one. However, it does not mention idempotency, error conditions, or side effects beyond labeling.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise (two sentences) and front-loaded with the main action. Every sentence adds value: first defines the operation, second specifies parameter usage and a critical behavioral rule.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity (4 parameters, no output schema), the description covers the core operation and a notable edge case. It does not explain return values or error handling, but for a label mutation tool, the behavioral details are adequate.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, but the description adds value by clarifying that positions[] and message_ids[] are alternative identifiers, and add_labels/remove_labels refer to label names. It also introduces the Triage/* auto-removal logic, which is not in the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: batch add/remove labels on emails. It specifies the action (modify labels), resource (emails), and unique behavior (Triage/* auto-removal), distinguishing it from sibling tools like list_labels (read-only) and create_label (single label creation).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for batch label operations but lacks explicit when-to-use or when-not-to-use guidance. It does not mention alternatives or prerequisites, though the Triage/* rule provides a specific conditional guideline.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool serves a unique function: listing unread emails, deleting, archiving, managing labels, and viewing recent actions. No two tools have overlapping purposes; even delete_emails and archive_emails are clearly distinguished by their actions.
All tool names follow a consistent verb_noun pattern in snake_case (e.g., list_unread_emails, create_label, modify_labels). The naming is predictable and makes the action-resource relationship clear.
With 7 tools, the server is well-scoped for basic Gmail inbox management and label operations. Each tool addresses a necessary operation without redundancy or unnecessary complexity.
The tool set covers core inbox operations (list, delete, archive) and label management (list, create, modify), but lacks essential features like sending emails, reading full email content, searching beyond unread, or marking read/unread. Gaps exist for a full email workflow.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.
Manage Gmail messages, threads, labels, drafts, and settings from your workflows. Send and organiz…
Stateful email for AI agents — read inboxes, reply in-thread, draft with approval.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Gmail by reading unread emails with automatic classification, creating AI-generated draft replies, and saving drafts directly to Gmail through the Gmail API.215MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Gmail accounts for reading unread emails, creating draft replies with proper threading, and managing messages, with optional professional writing guidelines, templates, and Google Docs/Calendar integration.
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Gmail through natural language interactions, including sending, reading, searching emails, and managing labels with auto authentication support.20,6271MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Gmail through natural language, including sending, reading, searching, labeling emails, managing attachments, and performing thread operations.3MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jnpacker/gmail-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server