get-issues
Retrieve and list issues from a specified Autodesk Construction Cloud project to track and manage construction-related problems and tasks.
Instructions
List all available projects in an Autodesk Construction Cloud account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes |
Implementation Reference
- src/tools/get-issues.ts:10-27 (handler)The main handler implementation for the 'get-issues' tool, including title, description, schema, and the async callback that processes the projectId, obtains an access token, strips 'b.' prefix, fetches issues via IssuesClient, and returns formatted content.export const getIssues: Tool<typeof schema> = { title: "get-issues", description: "List all available projects in an Autodesk Construction Cloud account", schema, callback: async ({ projectId }) => { // TODO: add pagination support const accessToken = await getAccessToken(["data:read"]); const issuesClient = new IssuesClient(); projectId = projectId.replace("b.", ""); // the projectId should not contain the "b." prefix const issues = await issuesClient.getIssues(projectId, { accessToken }); if (!issues.results) { throw new Error("No issues found"); } return { content: issues.results.map((issue) => ({ type: "text", text: JSON.stringify(issue) })) }; } };
- src/tools/get-issues.ts:6-8 (schema)Input schema definition using Zod, requiring a non-empty string projectId.const schema = { projectId: z.string().nonempty() };
- src/server.ts:12-14 (registration)Generic registration loop that registers the 'get-issues' tool (imported as part of tools) with the MCP server using server.tool().for (const tool of Object.values(tools)) { server.tool(tool.title, tool.description, tool.schema, tool.callback); }
- src/tools/index.ts:5-5 (registration)Re-export of the getIssues tool object from its source file, enabling its inclusion in the server's tools import.export { getIssues } from "./get-issues.js";
- src/tools/common.ts:15-27 (helper)Shared helper function to retrieve a cached APS access token for given scopes, called within the get-issues handler.export async function getAccessToken(scopes: string[]): Promise<string> { const cacheKey = scopes.join("+"); let credentials = credentialsCache.get(cacheKey); if (!credentials || credentials.expiresAt < Date.now()) { const { access_token, expires_in } = await getServiceAccountAccessToken(APS_CLIENT_ID!, APS_CLIENT_SECRET!, APS_SA_ID!, APS_SA_KEY_ID!, APS_SA_PRIVATE_KEY!, scopes); credentials = { accessToken: access_token, expiresAt: Date.now() + expires_in * 1000 }; credentialsCache.set(cacheKey, credentials); } return credentials.accessToken; }