MCPcopy
hub / github.com/TanStack/ai / createMockServerTool

Function createMockServerTool

packages/ai-code-mode/tests/tool-to-binding.test.ts:11–24  ·  view source on GitHub ↗
(
  name: TName,
  description = 'A test tool',
)

Source from the content-addressed store, hash-verified

9import type { ToolBinding, ToolExecutionContext } from '../src/types'
10
11function createMockServerTool<TName extends string>(
12 name: TName,
13 description = 'A test tool',
14) {
15 const def = toolDefinition({
16 name,
17 description,
18 inputSchema: z.object({ query: z.string() }),
19 outputSchema: z.object({ result: z.string() }),
20 })
21 return def.server(async (input) => ({
22 result: `response to ${input.query}`,
23 }))
24}
25
26describe('toolToBinding', () => {
27 it('converts ServerTool to ToolBinding with correct fields', () => {

Callers 1

Calls 1

toolDefinitionFunction · 0.90

Tested by

no test coverage detected