tdx-cmdb-add-relationship
Create connections between configuration items in TDX CMDB by specifying source, target, and relationship type IDs.
Instructions
Add a relationship between two TDX configuration items
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| appId | No | TDX app ID (defaults to env TDX_APP_ID) | |
| id | Yes | Source CI ID | |
| otherItemId | Yes | Target CI ID | |
| typeId | Yes | Relationship type ID | |
| isInverse | No | Whether this is an inverse relationship |
Implementation Reference
- src/tools/cmdb.ts:175-188 (handler)The handler function for tdx-cmdb-add-relationship, which sends a PUT request to the TDX API to create a relationship.
async (params) => { const app = params.appId ?? defaultAppId; const body: Record<string, unknown> = { OtherItemID: params.otherItemId, TypeID: params.typeId, }; if (params.isInverse !== undefined) body.IsInverse = params.isInverse; try { const result = await client.put(`/${app}/cmdb/${params.id}/relationships`, body); return { content: [{ type: "text", text: JSON.stringify(result ?? "Relationship added successfully", null, 2) }] }; } catch (e: unknown) { return { content: [{ type: "text", text: String(e) }], isError: true }; } } - src/tools/cmdb.ts:165-174 (registration)Registration of the tdx-cmdb-add-relationship tool with its schema definition using Zod.
server.tool( "tdx-cmdb-add-relationship", "Add a relationship between two TDX configuration items", { appId: z.number().optional().describe("TDX app ID (defaults to env TDX_APP_ID)"), id: z.number().describe("Source CI ID"), otherItemId: z.number().describe("Target CI ID"), typeId: z.number().describe("Relationship type ID"), isInverse: z.boolean().optional().describe("Whether this is an inverse relationship"), },