***

title: getTool
slug: /reference/typescript/agents/agent-base/get-tool
description: Look up a registered SwaigFunction by name.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

Look up a registered `SwaigFunction` by name.

## **Parameters**

<ParamField path="name" type="string" required={true} toc={true}>
  The tool name to search for.
</ParamField>

## **Returns**

`SwaigFunction | undefined` -- The `SwaigFunction` instance, or `undefined` if not
found or not a `SwaigFunction`.

## **Example**

```typescript {14}
import { AgentBase } from '@signalwire/sdk';

const agent = new AgentBase({ name: 'assistant', route: '/assistant' });
agent.defineTool({
  name: 'get_weather',
  description: 'Get the current weather',
  parameters: {
    type: 'object',
    properties: { city: { type: 'string' } },
  },
  handler: async (args) => ({ response: `Weather in ${args.city}: sunny` }),
});

const tool = agent.getTool('get_weather');
if (tool) {
  console.log(tool.description); // "Get the current weather"
}
```