Update Field
update_fieldUpdate an existing field in a collection by specifying the collection slug, field UUID, and new field properties such as type, label, and name.
Instructions
Update an existing field on a collection
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection_slug | Yes | The collection slug | |
| field_uuid | Yes | The UUID of the field to update | |
| type | Yes | Field type | |
| label | Yes | Display label | |
| name | Yes | Field identifier in kebab-case | |
| description | No | Field description | |
| placeholder | No | Placeholder text | |
| options | No | Field-specific options | |
| validations | No | Validation rules |
Implementation Reference
- src/tools/fields.ts:58-86 (registration)Registration of the 'update_field' tool with schema and handler. The input schema defines collection_slug (string), field_uuid (string), type, label, name, and optional description, placeholder, options, and validations. The handler destructures collection_slug and field_uuid, then sends a PUT request to /collections/{collection_slug}/fields/{field_uuid}.
server.registerTool("update_field", { title: "Update Field", description: "Update an existing field on a collection", inputSchema: { collection_slug: z.string().describe("The collection slug"), field_uuid: z.string().describe("The UUID of the field to update"), type: z.string().describe("Field type"), label: z.string().describe("Display label"), name: z.string().describe("Field identifier in kebab-case"), description: z.string().optional().describe("Field description"), placeholder: z.string().optional().describe("Placeholder text"), options: z .record(z.string(), z.unknown()) .optional() .describe("Field-specific options"), validations: z .record(z.string(), z.unknown()) .optional() .describe("Validation rules"), }, }, async ({ collection_slug, field_uuid, ...fieldData }) => { const result = await client.put( `/collections/${collection_slug}/fields/${field_uuid}`, fieldData ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }); - src/tools/fields.ts:78-86 (handler)The handler function for update_field. It receives collection_slug and field_uuid (extracted from parameters), spreads the remaining fieldData, and makes a PUT request to the Elmapi API endpoint /collections/{collection_slug}/fields/{field_uuid}. Returns the JSON-stringified response.
}, async ({ collection_slug, field_uuid, ...fieldData }) => { const result = await client.put( `/collections/${collection_slug}/fields/${field_uuid}`, fieldData ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }); - src/tools/fields.ts:61-77 (schema)Input validation schema for update_field using Zod. Defines required fields: collection_slug (string), field_uuid (string), type (string), label (string), name (string). Optional fields: description (string), placeholder (string), options (record), validations (record).
inputSchema: { collection_slug: z.string().describe("The collection slug"), field_uuid: z.string().describe("The UUID of the field to update"), type: z.string().describe("Field type"), label: z.string().describe("Display label"), name: z.string().describe("Field identifier in kebab-case"), description: z.string().optional().describe("Field description"), placeholder: z.string().optional().describe("Placeholder text"), options: z .record(z.string(), z.unknown()) .optional() .describe("Field-specific options"), validations: z .record(z.string(), z.unknown()) .optional() .describe("Validation rules"), },