tdx-cmdb-create
Create new configuration items (CIs) in the TDX Configuration Management Database (CMDB) to track IT assets and services.
Instructions
Create a new TDX configuration item (CI)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| appId | No | TDX app ID (defaults to env TDX_APP_ID) | |
| typeId | Yes | CI type ID | |
| name | Yes | CI name | |
| formId | No | Form ID | |
| isActive | No | Whether CI is active | |
| owningDepartmentId | No | Owning department ID | |
| owningCustomerId | No | Owning customer UID | |
| locationId | No | Location ID | |
| locationRoomId | No | Location room ID | |
| maintenanceScheduleId | No | Maintenance schedule ID | |
| externalId | No | External ID | |
| attributes | No | Custom attributes |
Implementation Reference
- src/tools/cmdb.ts:28-51 (handler)The asynchronous handler function that processes the request for 'tdx-cmdb-create', mapping input parameters to the API request body and invoking the TDX client.
async (params) => { const app = params.appId ?? defaultAppId; const body: Record<string, unknown> = { TypeID: params.typeId, Name: params.name, }; if (params.formId !== undefined) body.FormID = params.formId; if (params.isActive !== undefined) body.IsActive = params.isActive; if (params.owningDepartmentId !== undefined) body.OwningDepartmentID = params.owningDepartmentId; if (params.owningCustomerId !== undefined) body.OwningCustomerID = params.owningCustomerId; if (params.locationId !== undefined) body.LocationID = params.locationId; if (params.locationRoomId !== undefined) body.LocationRoomID = params.locationRoomId; if (params.maintenanceScheduleId !== undefined) body.MaintenanceScheduleID = params.maintenanceScheduleId; if (params.externalId !== undefined) body.ExternalID = params.externalId; if (params.attributes) { body.Attributes = params.attributes.map((a) => ({ ID: a.id, Value: String(a.value) })); } try { const result = await client.post(`/${app}/cmdb`, body); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (e: unknown) { return { content: [{ type: "text", text: String(e) }], isError: true }; } } - src/tools/cmdb.ts:11-27 (schema)Zod schema definitions for the input parameters of the 'tdx-cmdb-create' tool.
{ appId: z.number().optional().describe("TDX app ID (defaults to env TDX_APP_ID)"), typeId: z.number().describe("CI type ID"), name: z.string().describe("CI name"), formId: z.number().optional().describe("Form ID"), isActive: z.boolean().optional().describe("Whether CI is active"), owningDepartmentId: z.number().optional().describe("Owning department ID"), owningCustomerId: z.string().optional().describe("Owning customer UID"), locationId: z.number().optional().describe("Location ID"), locationRoomId: z.number().optional().describe("Location room ID"), maintenanceScheduleId: z.number().optional().describe("Maintenance schedule ID"), externalId: z.string().optional().describe("External ID"), attributes: z.array(z.object({ id: z.number().describe("Custom attribute ID"), value: z.union([z.string(), z.number(), z.boolean()]).describe("Attribute value"), })).optional().describe("Custom attributes"), }, - src/tools/cmdb.ts:8-52 (registration)Registration of the 'tdx-cmdb-create' tool using the server.tool method.
server.tool( "tdx-cmdb-create", "Create a new TDX configuration item (CI)", { appId: z.number().optional().describe("TDX app ID (defaults to env TDX_APP_ID)"), typeId: z.number().describe("CI type ID"), name: z.string().describe("CI name"), formId: z.number().optional().describe("Form ID"), isActive: z.boolean().optional().describe("Whether CI is active"), owningDepartmentId: z.number().optional().describe("Owning department ID"), owningCustomerId: z.string().optional().describe("Owning customer UID"), locationId: z.number().optional().describe("Location ID"), locationRoomId: z.number().optional().describe("Location room ID"), maintenanceScheduleId: z.number().optional().describe("Maintenance schedule ID"), externalId: z.string().optional().describe("External ID"), attributes: z.array(z.object({ id: z.number().describe("Custom attribute ID"), value: z.union([z.string(), z.number(), z.boolean()]).describe("Attribute value"), })).optional().describe("Custom attributes"), }, async (params) => { const app = params.appId ?? defaultAppId; const body: Record<string, unknown> = { TypeID: params.typeId, Name: params.name, }; if (params.formId !== undefined) body.FormID = params.formId; if (params.isActive !== undefined) body.IsActive = params.isActive; if (params.owningDepartmentId !== undefined) body.OwningDepartmentID = params.owningDepartmentId; if (params.owningCustomerId !== undefined) body.OwningCustomerID = params.owningCustomerId; if (params.locationId !== undefined) body.LocationID = params.locationId; if (params.locationRoomId !== undefined) body.LocationRoomID = params.locationRoomId; if (params.maintenanceScheduleId !== undefined) body.MaintenanceScheduleID = params.maintenanceScheduleId; if (params.externalId !== undefined) body.ExternalID = params.externalId; if (params.attributes) { body.Attributes = params.attributes.map((a) => ({ ID: a.id, Value: String(a.value) })); } try { const result = await client.post(`/${app}/cmdb`, body); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (e: unknown) { return { content: [{ type: "text", text: String(e) }], isError: true }; } } );