createNotificationInboxTool()
追加バージョン: @mastra/core@1.39.0
createNotificationInboxTool() は、現在の Thread の通知受信ボックスレコードを Agent が確認、管理できる Mastra Tool を作成します。
この Tool は Durable Notification Signal とともに使用します。通知レコードの送信については、Agent.sendNotificationSignal() を参照してください。
使用例使用例への直接リンク
次の例では、受信ボックス Tool を Agent に追加します。
src/mastra/agents/support-agent.ts
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 の設定。
object
storage:
NotificationsStorage
storage.getStore('notifications') が返す通知ストレージドメイン。Tool の入力Tool の入力への直接リンク
生成される Tool の ID は notification-inbox で、次の入力フィールドを受け取ります。
action:
'list' | 'read' | 'markSeen' | 'dismiss' | 'archive' | 'search'
実行する受信ボックス Action。
threadId?:
string
確認する Thread ID。利用可能な場合は、現在の Agent Thread がデフォルトになります。
id?:
string
通知 ID。
markSeen、dismiss、archive では必須です。read では省略できます。status?:
'pending' | 'delivered' | 'seen' | 'dismissed' | 'archived' | 'discarded'
list、read、search Action のステータスフィルター。
priority?:
'low' | 'medium' | 'high' | 'urgent'
list、read、search Action の優先度フィルター。
source?:
string
list、read、search Action の Source フィルター。
query?:
string
検索クエリ。
action が search の場合は必須です。limit?:
number
返す通知の最大数。正の整数である必要があります。
ActionActionへの直接リンク
| Action | 説明 |
|---|---|
list | 条件に一致する通知を返します。 |
read | 読み取り可能な通知内容を Signal として配信し、配信済みのレコードを確認済みにします。 |
markSeen | 1 件の通知を確認済みにします。 |
dismiss | 1 件の通知を破棄済みにします。 |
archive | 1 件の通知をアーカイブ済みにします。 |
search | クエリと省略可能なフィルターを使用して通知を検索します。 |
read が保留中または配信済みの通知を検出すると、通常の Tool 出力として全内容を返す代わりに、その内容を Notification Signal として配信します。Agent が <notification-summary> Signal の背後にある完全なレコードを必要とする場合に、その Signal の後で使用してください。