getTools

View as MarkdownOpen in Claude

Return the SWAIG tool definitions this skill exposes. Called by the SkillManager at SWML render time to collect every tool that should appear in the agent’s SWAIG block.

The default implementation returns tools registered imperatively via defineTool(). Skills that build their tool list declaratively should override this method to return a static array.

This replaces the Python register_tools() abstract method. TS uses a pull model: you return the list, rather than calling back into the agent once per tool.

Returns

SkillToolDefinition[] — array of tool definitions.

Example — declarative override

1import { SkillBase, type SkillToolDefinition } from '@signalwire/sdk';
2
3class WeatherSkill extends SkillBase {
4 static override SKILL_NAME = 'weather';
5 static override SKILL_DESCRIPTION = 'Provides weather information';
6
7 override getTools(): SkillToolDefinition[] {
8 return [{
9 name: 'get_weather',
10 description: 'Get current weather for a location',
11 parameters: {
12 location: { type: 'string', description: 'City name' },
13 },
14 required: ['location'],
15 handler: async (args) => ({ response: `Weather in ${args.location}: sunny, 72F` }),
16 }];
17 }
18}

Example — imperative via defineTool()

1class ConfigurableSkill extends SkillBase {
2 static override SKILL_NAME = 'configurable';
3 static override SKILL_DESCRIPTION = 'Tools depend on config';
4
5 override async setup(): Promise<boolean> {
6 this.defineTool({
7 name: this.getConfig('tool_name', 'run'),
8 description: this.getConfig('description', 'Run the action'),
9 parameters: {},
10 handler: async () => ({ response: 'done' }),
11 });
12 return true;
13 }
14}