NewWacht Bench is live — AI-assisted development for Wacht

getTool()

This method manages AI tool definitions or agent-to-tool bindings.

Usage

The following example shows a basic usage of the backend client from @wacht/nextjs/server.

import { wachtClient } from '@wacht/nextjs/server';export async function example() {  const client = await wachtClient();  const toolId: string = 'toolid-123';  return client.ai.getTool(toolId);}

Signature

function getTool(  toolId: string,  client?: WachtClient,): Promise<AiToolWithDetails>

Parameters

toolId: string;
Target tool id.

Return value

id?: string | undefined;
Tool id.
name?: string | undefined;
Tool display name.
kind?: string | undefined;
Tool kind/type.

Examples

AI usage pattern

import { wachtClient } from '@wacht/nextjs/server';export async function attachTool(agentId: string) {  const client = await wachtClient();  const tool = await client.ai.createTool({    name: 'fetch-user-profile',    kind: 'api',    configuration: {},  });  await client.ai.attachAgentTool(agentId, tool.id);  return tool;}

On this page