feat: add tea-notification.ts tool for notifications (notificationList)
This commit is contained in:
21
.opencode/tools/tea-notification.ts
Normal file
21
.opencode/tools/tea-notification.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { tool } from "@opencode-ai/plugin"
|
||||
import { $ } from "bun"
|
||||
|
||||
export const notificationList = tool({
|
||||
description: "List unread notifications including PR reviews, mentions, and other updates",
|
||||
args: {
|
||||
limit: tool.schema.number().default(30).describe("Number of notifications to return"),
|
||||
},
|
||||
async execute(args, context) {
|
||||
try {
|
||||
const result = await $`tea notification list --output json --limit ${args.limit}`.text()
|
||||
return JSON.parse(result)
|
||||
} catch (error: any) {
|
||||
return {
|
||||
error: "Failed to list notifications",
|
||||
message: error.message,
|
||||
stderr: error.stderr?.toString(),
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user