2026-06-11 10:55:05 +08:00
|
|
|
import type { Context } from 'cordis'
|
2026-06-11 12:39:27 +08:00
|
|
|
import { defineTool } from '@deepseek-ai/dsh-tools'
|
2026-06-11 10:55:05 +08:00
|
|
|
|
|
|
|
|
export const name = 'echo-tool'
|
|
|
|
|
export const inject = ['tools']
|
|
|
|
|
|
|
|
|
|
export function apply(ctx: Context) {
|
2026-06-11 12:39:27 +08:00
|
|
|
ctx.tools.register(defineTool({
|
2026-06-11 10:55:05 +08:00
|
|
|
name: 'echo',
|
|
|
|
|
description: 'Echo the given text back, uppercased.',
|
|
|
|
|
parameters: {
|
2026-06-11 12:39:27 +08:00
|
|
|
text: { type: 'string', required: true },
|
2026-06-11 10:55:05 +08:00
|
|
|
},
|
2026-06-11 12:39:27 +08:00
|
|
|
async execute(args) {
|
|
|
|
|
// args is typed: { text: string }
|
|
|
|
|
return [{ type: 'text', text: `ECHO: ${args.text.toUpperCase()}` }]
|
2026-06-11 10:55:05 +08:00
|
|
|
},
|
2026-06-11 12:39:27 +08:00
|
|
|
}))
|
2026-06-11 10:55:05 +08:00
|
|
|
}
|