getDataMapTools

View as MarkdownOpen in Claude

Return fully-built SWAIG function dicts for tools that this skill builds via DataMap or any other path that produces a complete SWAIG function object (rather than a SkillToolDefinition handled by the default tool pipeline).

When a skill is added to an agent, AgentBase.addSkill() iterates the result and registers each entry via registerSwaigFunction.

Default returns []. Skills that only use the declarative getTools() path do not need to override this method.

Returns

Record<string, unknown>[] — array of pre-built SWAIG function dicts.

Example

1import { SkillBase, DataMap } from '@signalwire/sdk';
2
3class LookupSkill extends SkillBase {
4 static override SKILL_NAME = 'lookup';
5 static override SKILL_DESCRIPTION = 'Server-side lookup via DataMap';
6
7 override getDataMapTools(): Record<string, unknown>[] {
8 const dm = new DataMap('do_lookup')
9 .description('Look up a value by id')
10 .parameter('id', 'string', 'Record id', { required: true })
11 .webhook('GET', 'https://api.example.com/lookup/${args.id}');
12 return [dm.toSwaigFunction()];
13 }
14}