Get Tracker
get_trackerRetrieve a Codebeamer tracker's details and field schema to construct cbQL queries for items in that tracker.
Instructions
Get details of a Codebeamer tracker including its field schema. The field list shows what fields are available for items in this tracker, useful for constructing cbQL queries.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| trackerId | Yes | Numeric tracker ID |
Implementation Reference
- src/tools/trackers.ts:63-72 (handler)Handler/execution function for the get_tracker tool. It fetches tracker details, fields, and items in parallel, then formats the output.
async ({ trackerId }) => { const [tracker, fields, { items }] = await Promise.all([ client.getTracker(trackerId), client.getTrackerFields(trackerId), client.listTrackerItems(trackerId, 1, 100), ]); return { content: [{ type: "text", text: formatTracker(tracker, fields, items) }], }; }, - src/tools/trackers.ts:49-61 (schema)Input schema for get_tracker: takes a single 'trackerId' (positive integer) parameter.
{ title: "Get Tracker", description: "Get details of a Codebeamer tracker including its field schema. " + "The field list shows what fields are available for items in this tracker, " + "useful for constructing cbQL queries.", inputSchema: { trackerId: z .number() .int() .positive() .describe("Numeric tracker ID"), }, - src/tools/trackers.ts:47-73 (registration)Registration of the 'get_tracker' tool via server.registerTool() within registerTrackerTools().
server.registerTool( "get_tracker", { title: "Get Tracker", description: "Get details of a Codebeamer tracker including its field schema. " + "The field list shows what fields are available for items in this tracker, " + "useful for constructing cbQL queries.", inputSchema: { trackerId: z .number() .int() .positive() .describe("Numeric tracker ID"), }, }, async ({ trackerId }) => { const [tracker, fields, { items }] = await Promise.all([ client.getTracker(trackerId), client.getTrackerFields(trackerId), client.listTrackerItems(trackerId, 1, 100), ]); return { content: [{ type: "text", text: formatTracker(tracker, fields, items) }], }; }, ); - src/client/codebeamer-client.ts:235-237 (handler)Client method getTracker() that makes the HTTP GET request to /trackers/{id}.
getTracker(id: number): Promise<CbTracker> { return this.http.get(`/trackers/${id}`, { resource: `tracker ${id}` }); } - formatTracker() helper function that formats the tracker details, fields, and items into a Markdown string.
export function formatTracker( tracker: CbTracker, fields: CbTrackerField[], items: CbItem[] = [], ): string { const lines: string[] = [ `## ${tracker.name}`, "", `- **ID:** ${tracker.id}`, `- **Type:** ${tracker.type?.name ?? "?"}`, `- **Project:** ${tracker.project?.name ?? "?"} (ID: ${tracker.project?.id ?? "?"})`, ]; if (tracker.keyName) { lines.push(`- **Key:** ${tracker.keyName}`); } if (tracker.description) { lines.push("", "### Description", "", tracker.description); } if (fields.length > 0) { const visibleFields = fields.filter((f) => !f.hidden); lines.push("", "### Fields", ""); lines.push("| ID | Name | Type | Required |"); lines.push("|----|------|------|----------|"); for (const f of visibleFields) { lines.push( `| ${f.fieldId} | ${f.name} | ${f.type ?? "-"} | ${f.required ? "Yes" : "No"} |`, ); } } if (items.length > 0) { lines.push("", `### Items (${items.length})`, ""); lines.push("| ID | Name | Status | Type | Description |"); lines.push("|----|------|--------|------|-------------|"); for (const item of items) { const desc = extractDescription(item.description); lines.push( `| ${item.id} | ${item.name} | ${item.status?.name ?? "-"} | ${item.tracker?.type ?? tracker.type?.name ?? "-"} | ${desc} |`, ); } } return lines.join("\n"); }