***

title: parameter
slug: /reference/typescript/agents/data-map/parameter
description: Add a function parameter to the tool definition.
max-toc-depth: 3
---------------------

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

[ref-datamap]: /docs/server-sdks/reference/typescript/agents/data-map

Add a function parameter to the tool definition.

## **Parameters**

<ParamField path="name" type="string" required={true} toc={true}>
  Parameter name.
</ParamField>

<ParamField path="paramType" type="string" required={true} toc={true}>
  JSON schema type for the parameter.

  * `"string"` -- text value
  * `"integer"` -- whole number value
  * `"number"` -- numeric value including decimals
  * `"boolean"` -- true or false value
  * `"array"` -- list of values
  * `"object"` -- nested key-value structure
</ParamField>

<ParamField path="description" type="string" required={true} toc={true}>
  Description of the parameter shown to the AI.
</ParamField>

<ParamField path="opts" type="object" toc={true}>
  Optional configuration.
</ParamField>

<Indent>
  <ParamField path="opts.required" type="boolean" toc={true}>
    Whether this parameter is required.
  </ParamField>

  <ParamField path="opts.enum" type="string[]" toc={true}>
    Optional list of allowed values for this parameter.
  </ParamField>
</Indent>

## **Returns**

[`DataMap`][ref-datamap] -- Self for method chaining.

## **Example**

```typescript {6-7}
import { DataMap } from '@signalwire/sdk';

const weather = new DataMap('get_weather');
weather
  .purpose('Get current weather for a city')
  .parameter('city', 'string', 'City name', { required: true })
  .parameter('units', 'string', 'Temperature units', { enum: ['fahrenheit', 'celsius'] });

console.log(weather.toSwaigFunction());
```