> Discover all available pages from the documentation index: https://mastra.zisheng.pro/llms.txt # createNotificationInboxTool() **新增于:** `@mastra/core@1.39.0` `createNotificationInboxTool()` 会创建一个 Mastra Tool,使 Agent 能够检查和管理当前 thread 的通知收件箱记录。 将此 Tool 与持久通知 Signal 一起使用。如需发送通知记录,请参阅 [`Agent.sendNotificationSignal()`](https://mastra.zisheng.pro/reference/agents/agent)。 ## 使用示例 以下示例将收件箱 Tool 添加到 Agent。 ```typescript import { Agent } from '@mastra/core/agent' import { createNotificationInboxTool } from '@mastra/core/notifications' const notificationsStorage = await storage.getStore('notifications') export const supportAgent = new Agent({ id: 'support-agent', name: 'Support Agent', instructions: 'Help the user triage updates.', model: 'openai/gpt-5.6-sol', tools: { notificationInbox: createNotificationInboxTool({ storage: notificationsStorage }), }, }) ``` ## 参数 **options** (`object`): Tool 配置。 **options.storage** (`NotificationsStorage`): 由 storage.getStore('notifications') 返回的通知 storage domain。 ## Tool 输入 生成的 Tool 的 id 为 `notification-inbox`,并接受以下输入字段。 **action** (`'list' | 'read' | 'markSeen' | 'dismiss' | 'archive' | 'search'`): 要执行的收件箱操作。 **threadId** (`string`): 要检查的 thread ID。可用时默认为当前 Agent thread。 **id** (`string`): 通知 ID。markSeen、dismiss 和 archive 必需;read 可选。 **status** (`'pending' | 'delivered' | 'seen' | 'dismissed' | 'archived' | 'discarded'`): 用于 list、read 或 search 操作的状态筛选条件。 **priority** (`'low' | 'medium' | 'high' | 'urgent'`): 用于 list、read 或 search 操作的优先级筛选条件。 **source** (`string`): 用于 list、read 或 search 操作的来源筛选条件。 **query** (`string`): 搜索查询。当 action 为 search 时必需。 **limit** (`number`): 返回的通知最大数量。必须为正整数。 ## 操作 | 操作 | 说明 | | ---------- | ------------------------------------ | | `list` | 返回匹配的通知。 | | `read` | 将可读的通知内容作为 Signal 投递,并将已投递的记录标记为已查看。 | | `markSeen` | 将一条通知标记为已查看。 | | `dismiss` | 将一条通知标记为已忽略。 | | `archive` | 将一条通知标记为已归档。 | | `search` | 按查询和可选筛选条件搜索通知。 | 当 `read` 找到待处理或已投递的通知时,Tool 会将其内容作为通知 Signal 投递,而不是以常规 Tool 输出返回完整内容。当 Agent 在 `` Signal 后需要摘要背后的完整记录时,请使用此操作。