create_device_custom_field
Define a new custom field for organization devices by specifying a name, unique code, and field type. Optionally configure dropdown options for dropdown-type fields.
Instructions
Create a new custom field for organization devices. Defines a new field that can be used across all devices in the organization.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| attributeName | Yes | Display label for the custom field (REQUIRED) | |
| attributeCode | Yes | Unique identifier for the custom field. Must contain only lowercase letters, numbers, and underscores (REQUIRED) | |
| kind | Yes | The type of the custom field (REQUIRED) | |
| configuration | No | Dropdown configuration with values. Only required for 'dropdown' kind fields. |
Implementation Reference
- The handler function 'createDeviceCustomField' that executes the tool logic. Constructs a body with attributeName, attributeCode, kind, and optionally configuration, then POSTs it to /fields/custom.
export async function createDeviceCustomField(params: CreateDeviceCustomFieldParams) { const client = getClient(); const body: Record<string, unknown> = { attributeName: params.attributeName, attributeCode: params.attributeCode, kind: params.kind, }; if (params.configuration !== undefined) body.configuration = params.configuration; return client.makePostApiCall("/fields/custom", new URLSearchParams(), body); } - The Zod schema 'CreateDeviceCustomFieldSchema' defining input validation for the tool, including required attributeName, attributeCode, kind (text/number/date/dropdown), and optional dropdown configuration.
export const CreateDeviceCustomFieldSchema = z.object({ attributeName: z.string().describe("Display label for the custom field (REQUIRED)"), attributeCode: z .string() .describe( "Unique identifier for the custom field. Must contain only lowercase letters, numbers, and underscores (REQUIRED)", ), kind: z.enum(["text", "number", "date", "dropdown"]).describe("The type of the custom field (REQUIRED)"), configuration: DropdownConfigurationSchema.optional().describe( "Dropdown configuration with values. Only required for 'dropdown' kind fields.", ), });