feat: add tool respond helpers, test harness

This commit is contained in:
smartass
2026-06-12 00:03:36 +05:00
parent 52baa59f97
commit 0c92dd6755
2 changed files with 59 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'
export const ok = (payload: unknown): CallToolResult => ({
content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }]
})
export const fail = (message: string): CallToolResult => ({
content: [{ type: 'text', text: message }],
isError: true
})
export const errorMessage = (error: unknown): string =>
error instanceof Error ? error.message : String(error)