List Projects
list_projectsRetrieve a list of accessible Codebeamer projects, including IDs, names, and keys. Use project IDs to fetch trackers or items.
Instructions
List all Codebeamer projects the authenticated user can access. Returns a summary table with project IDs, names, and keys. Use the returned IDs to fetch trackers or items.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_projects"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number (starts at 1) | |
| pageSize | No | Items per page (max 100) |
Implementation Reference
- src/tools/projects.ts:13-41 (handler)Registration of the 'list_projects' tool with McpServer. The handler calls client.listProjects() and formats the result via formatProjectList().
server.registerTool( "list_projects", { title: "List Projects", description: "List all Codebeamer projects the authenticated user can access. " + "Returns a summary table with project IDs, names, and keys. " + "Use the returned IDs to fetch trackers or items.", inputSchema: { page: z .number() .int() .min(1) .default(1) .describe("Page number (starts at 1)"), pageSize: z .number() .int() .min(1) .max(100) .default(25) .describe("Items per page (max 100)"), }, }, async ({ page, pageSize }) => { const result = await client.listProjects(page, pageSize); return { content: [{ type: "text", text: formatProjectList(result) }] }; }, ); - src/tools/projects.ts:21-35 (schema)Input schema for 'list_projects' using Zod: page (default 1, min 1) and pageSize (default 25, max 100).
inputSchema: { page: z .number() .int() .min(1) .default(1) .describe("Page number (starts at 1)"), pageSize: z .number() .int() .min(1) .max(100) .default(25) .describe("Items per page (max 100)"), }, - Formatting helper formatProjectList() that converts an array of CbProject objects into a markdown table string.
export function formatProjectList(projects: CbProject[]): string { const header = `## Projects (${projects.length} total)\n`; if (projects.length === 0) return `${header}\n_No projects found._`; const rows = projects.map( (p) => `| ${p.id} | ${p.name} | ${p.keyName ?? "-"} | ${p.closed ? "Closed" : "Open"} |`, ); return [ header, "| ID | Name | Key | Status |", "|----|------|-----|--------|", ...rows, ].join("\n"); }