feat: add tool respond helpers, test harness
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user