Files
deepseek-harness/examples/echo-agent/src/echo-tool.ts
T

20 lines
533 B
TypeScript
Raw Normal View History

2026-06-11 10:55:05 +08:00
import type { Context } from 'cordis'
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) {
ctx.tools.register(defineTool({
2026-06-11 10:55:05 +08:00
name: 'echo',
description: 'Echo the given text back, uppercased.',
parameters: {
text: { type: 'string', required: true },
2026-06-11 10:55:05 +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 10:55:05 +08:00
}