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

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