create_association
Link two Codebeamer work items with relationships like 'depends on', 'blocks', or 'related to' to establish dependencies and connections between tasks.
Instructions
Create an association (link) between two Codebeamer work items. Common association types: 'depends on', 'blocks', 'related to', 'derived from'. Use get_item_relations on an existing item to discover valid association type IDs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fromItemId | Yes | Source item ID | |
| toItemId | Yes | Target item ID | |
| typeId | Yes | Association type ID (use get_item_relations to discover types) | |
| description | No | Optional description for the association |
Implementation Reference
- src/tools/associations-write.ts:41-56 (handler)The handler function for the `create_association` tool in `associations-write.ts` which calls `client.createAssociation`.
async ({ fromItemId, toItemId, typeId, description }) => { const result = await client.createAssociation({ from: { id: fromItemId }, to: { id: toItemId }, type: { id: typeId }, description, }); const text = `**Association created** (ID: ${result.id})\n\n` + `| Field | Value |\n|---|---|\n` + `| From | #${fromItemId} |\n` + `| To | #${toItemId} |\n` + `| Type | ${result.type?.name ?? typeId} |` + (description ? `\n| Description | ${description} |` : ""); return { content: [{ type: "text", text }] }; }, - src/tools/associations-write.ts:9-40 (registration)The registration block for the `create_association` tool.
server.registerTool( "create_association", { title: "Create Association", description: "Create an association (link) between two Codebeamer work items. " + "Common association types: 'depends on', 'blocks', 'related to', 'derived from'. " + "Use get_item_relations on an existing item to discover valid association type IDs.", inputSchema: { fromItemId: z .number() .int() .positive() .describe("Source item ID"), toItemId: z .number() .int() .positive() .describe("Target item ID"), typeId: z .number() .int() .positive() .describe( "Association type ID (use get_item_relations to discover types)", ), description: z .string() .optional() .describe("Optional description for the association"), }, }, - src/client/codebeamer-client.ts:317-322 (handler)The actual API call implementation for `createAssociation` inside the `CodebeamerClient`.
createAssociation(data: CbCreateAssociationRequest): Promise<CbAssociation> { return this.http.post("/associations", { body: data, resource: "create association", }); }