> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # toSwaigFunction > Convert the DataMap to a SWAIG function definition object. [ref-datamap]: /docs/server-sdks/reference/typescript/agents/data-map Convert this [DataMap][ref-datamap] to a SWAIG function definition object. Register the result with your agent using `agent.registerSwaigFunction()`. ## **Returns** `Record` -- An object containing the function name, description, parameter schema, and `data_map` configuration (instead of a webhook URL). ## **Example** ```typescript {9} import { DataMap, FunctionResult } from '@signalwire/sdk'; const dm = new DataMap('get_weather'); dm.purpose('Look up weather'); dm.parameter('city', 'string', 'City name', { required: true }); dm.webhook('GET', 'https://api.weather.com/v1/current?q=${args.city}'); dm.output(new FunctionResult('Weather: ${response.current.temp_f}F')); const swaigDef = dm.toSwaigFunction(); console.log(JSON.stringify(swaigDef, null, 2)); ``` > Convert the DataMap to a SWAIG function definition object.