MCPcopy Create free account
hub / github.com/TanStack/ai / mcpToolDef

Function mcpToolDef

packages/ai-mcp/tests/tools.test.ts:24–34  ·  view source on GitHub ↗

* Build an MCP tool definition for `toServerTools`. The MCP-Apps `_meta.ui` * link is a custom extension not present in the SDK's base `Tool` schema, so * the assembled literal needs one cast to `McpToolDef` — centralized here * instead of scattering `as never` across each test def.

(def: {
  name: string
  description?: string
  inputSchema?: { type: 'object'; properties?: Record<string, unknown> }
  _meta?: { ui?: { resourceUri?: string } }
})

Source from the content-addressed store, hash-verified

22 * instead of scattering `as never` across each test def.
23 */
24function mcpToolDef(def: {
25 name: string
26 description?: string
27 inputSchema?: { type: 'object'; properties?: Record<string, unknown> }
28 _meta?: { ui?: { resourceUri?: string } }
29}): McpToolDef {
30 return {
31 inputSchema: { type: 'object', properties: {} },
32 ...def,
33 } as McpToolDef
34}
35
36/**
37 * Build a fake MCP `Client` that only implements `callTool` — the single

Callers 1

tools.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected