list-projects
Retrieve and display all available projects from the Strateegia API to manage and organize your collaborative initiatives efficiently.
Instructions
List projects from Strateegia API
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:111-153 (handler)Executes the 'list-projects' tool by fetching labs and projects from the Strateegia API, processing them into a formatted summary, and returning a text response.if (request.params.name === "list-projects") { const labs: StrateegiaItemResponse[] = await fetchStrateegiaAPI( "/projects/v1/project" ); if (labs.length === 0) { return { content: [ { type: "text", text: "No labs found. Make sure your access token has the correct permissions.", }, ], }; } let labCount = 0; let projectCount = 0; const projectsSummary = labs .map((item) => { labCount++; projectCount += item.projects.length; return `Lab: ${item.lab.name} (ID: ${ item.lab.id })\nProjects:\n${item.projects .map((project) => { return `- ${project.title} (ID: ${project.id})`; }) .join("\n")}`; }) .join("\n\n"); const fullResponse = `Found ${labCount} labs and ${projectCount} projects:\n\n${projectsSummary}`; return { content: [ { type: "text", text: fullResponse, }, ], };
- src/index.ts:29-37 (schema)Schema definition for the 'list-projects' tool, specifying name, description, and empty input schema.const LIST_PROJECTS_TOOL: Tool = { name: "list-projects", description: "List projects from Strateegia API", inputSchema: { type: "object", properties: {}, required: [], }, };
- src/index.ts:106-108 (registration)Registers the 'list-projects' tool in the ListToolsRequestSchema handler.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [LIST_PROJECTS_TOOL], }));
- src/index.ts:86-103 (helper)Helper function to fetch data from Strateegia API with authentication, used by the list-projects handler.async function fetchStrateegiaAPI(endpoint: string): Promise<any> { const accessToken = await getAccessToken(); const response = await fetch(`${API_BASE_URL}${endpoint}`, { headers: { Authorization: `Bearer ${accessToken}`, "Content-Type": "application/json", }, }); if (!response.ok) { const errorText = await response.text(); throw new Error( `API request failed: ${response.status} ${response.statusText} - ${errorText}` ); } return response.json(); }
- src/index.ts:11-25 (schema)TypeScript interfaces defining the structure of Strateegia API responses used by the list-projects tool.interface StrateegiaItemResponse { lab: StrateegiaLabs; projects: StrateegiaProject[]; } interface StrateegiaLabs { id: string; name: string; owner_name: string; } interface StrateegiaProject { id: string; title: string; }