Skip to main content
Glama

Create Downstream Reference

create_reference

Create a downstream reference linking two Codebeamer items to establish derivation or traceability. The source item points to the target item as a downstream dependency.

Instructions

Add a downstream reference from one Codebeamer item to another. Downstream references represent derivation/traceability links (e.g. a requirement derived from another). The 'from' item gets the downstream reference pointing to the 'to' item.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromItemIdYesItem ID that will have the downstream reference added
toItemIdYesItem ID to reference as downstream

Implementation Reference

  • Registration of the 'create_reference' tool on the MCP server with inputSchema (fromItemId, toItemId) and handler callback.
    server.registerTool(
      "create_reference",
      {
        title: "Create Downstream Reference",
        description:
          "Add a downstream reference from one Codebeamer item to another. " +
          "Downstream references represent derivation/traceability links (e.g. a requirement derived from another). " +
          "The 'from' item gets the downstream reference pointing to the 'to' item.",
        inputSchema: {
          fromItemId: z
            .number()
            .int()
            .positive()
            .describe("Item ID that will have the downstream reference added"),
          toItemId: z
            .number()
            .int()
            .positive()
            .describe("Item ID to reference as downstream"),
        },
      },
      async ({ fromItemId, toItemId }) => {
        await client.createDownstreamReference(fromItemId, toItemId);
        const text =
          `**Downstream reference created**\n\n` +
          `| Field | Value |\n|---|---|\n` +
          `| Upstream (from) | #${fromItemId} |\n` +
          `| Downstream (to) | #${toItemId} |`;
        return { content: [{ type: "text", text }] };
      },
    );
  • Handler function for 'create_reference' that calls client.createDownstreamReference(fromItemId, toItemId) and returns a formatted success message.
    async ({ fromItemId, toItemId }) => {
      await client.createDownstreamReference(fromItemId, toItemId);
      const text =
        `**Downstream reference created**\n\n` +
        `| Field | Value |\n|---|---|\n` +
        `| Upstream (from) | #${fromItemId} |\n` +
        `| Downstream (to) | #${toItemId} |`;
      return { content: [{ type: "text", text }] };
    },
  • Input schema definition for 'create_reference': requires fromItemId and toItemId (positive integers), with title and description metadata.
    {
      title: "Create Downstream Reference",
      description:
        "Add a downstream reference from one Codebeamer item to another. " +
        "Downstream references represent derivation/traceability links (e.g. a requirement derived from another). " +
        "The 'from' item gets the downstream reference pointing to the 'to' item.",
      inputSchema: {
        fromItemId: z
          .number()
          .int()
          .positive()
          .describe("Item ID that will have the downstream reference added"),
        toItemId: z
          .number()
          .int()
          .positive()
          .describe("Item ID to reference as downstream"),
      },
  • createDownstreamReference method on CodebeamerClient - fetches the target item, finds the superordinateRequirement field in the tracker schema, and sets it via a PUT request to /items/{toItemId}/fields.
    async createDownstreamReference(fromItemId: number, toItemId: number): Promise<void> {
      // Downstream reference is created by setting the "superordinateRequirement" field
      // on the downstream (to) item to point to the upstream (from) item.
      const toItem = await this.getItem(toItemId);
      const trackerId = toItem.tracker?.id;
      if (!trackerId) throw new Error(`Cannot determine tracker for item ${toItemId}`);
    
      const schema = await this.getTrackerSchema(trackerId);
      const superordinateField = schema.find(
        (f) => f.legacyRestName === "superordinateRequirement",
      );
      if (!superordinateField) {
        throw new Error(
          `Tracker ${trackerId} has no superordinateRequirement field. Cannot create downstream reference.`,
        );
      }
    
      const fields = await this.getItemEditableFields(toItemId);
      const currentField = fields.find((f) => f.fieldId === superordinateField.id);
      const existingValues = currentField?.values ?? [];
      if (existingValues.some((v) => v.id === fromItemId)) return; // already linked
    
      const newValues = [...existingValues, { id: fromItemId, type: "TrackerItemReference" }];
    
      await this.http.put(`/items/${toItemId}/fields`, {
        body: {
          fieldValues: [
            {
              fieldId: superordinateField.id,
              type: "ChoiceFieldValue",
              values: newValues,
            },
          ],
        },
        resource: `add downstream reference from ${fromItemId} to ${toItemId}`,
      });
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavior. It clarifies the direction of the reference (from item gets downstream pointer to to item). But it does not mention side effects like overwriting existing references, required permissions, or error handling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long, front-loaded with the core action, and contains no unnecessary words. Every sentence contributes meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple two-parameter tool with no output schema or annotations, the description covers the essential concept and direction. It could mention potential issues like duplicate references or item existence, but overall it is adequately complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with clear descriptions for both parameters. The description adds extra value by explaining the role of each parameter in the context of derivation/traceability, going beyond the schema's basic identification.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's action ('Add a downstream reference') and identifies the specific resource (Codebeamer items). It explains the concept of downstream references as derivation/traceability links, which distinguishes it from siblings like 'create_association'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when to use the tool—for creating derivation/traceability links between items. However, it does not explicitly state when not to use it or mention alternatives like 'create_association' for other types of links.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/3KniGHtcZ/codebeamer-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server