get-issue-comments
Retrieve comments linked to a specific issue in Autodesk Construction Cloud by specifying the project and issue IDs using the APS MCP Server's Node.js implementation.
Instructions
Retrieves a list of comments associated with an issue in Autodesk Construction Cloud.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issueId | Yes | ||
| projectId | Yes |
Implementation Reference
- src/tools/get-issue-comments.ts:15-27 (handler)Handler function that authenticates via getAccessToken, normalizes projectId, retrieves comments with IssuesClient.getComments, and formats results as MCP content.callback: async ({ projectId, issueId }) => { // 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 comments = await issuesClient.getComments(projectId, issueId, { accessToken}) if (!comments.results) { throw new Error("No comments found"); } return { content: comments.results.map((comment) => ({ type: "text", text: JSON.stringify(comment) })) }; }
- src/tools/get-issue-comments.ts:6-9 (schema)Zod schema defining required string inputs: projectId and issueId.const schema = { projectId: z.string().nonempty(), issueId: z.string().nonempty() };
- src/server.ts:12-14 (registration)Generic registration loop that adds all tools from tools/index.js (including get-issue-comments via title) to the MCP server.for (const tool of Object.values(tools)) { server.tool(tool.title, tool.description, tool.schema, tool.callback); }
- src/tools/index.ts:8-8 (registration)Re-exports the tool for convenient bulk import into server.ts.export { getIssueComments } from "./get-issue-comments.js";
- src/tools/common.ts:15-27 (helper)Shared helper for obtaining and caching APS access tokens based on scopes, used in the tool 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; }