echo-tool.ts 533 B

12345678910111213141516171819
  1. import type { Context } from 'cordis'
  2. import { defineTool } from '@deepseek-ai/dsh-tools'
  3. export const name = 'echo-tool'
  4. export const inject = ['tools']
  5. export function apply(ctx: Context) {
  6. ctx.tools.register(defineTool({
  7. name: 'echo',
  8. description: 'Echo the given text back, uppercased.',
  9. parameters: {
  10. text: { type: 'string', required: true },
  11. },
  12. async execute(args) {
  13. // args is typed: { text: string }
  14. return [{ type: 'text', text: `ECHO: ${args.text.toUpperCase()}` }]
  15. },
  16. }))
  17. }