get-issue-comments
Retrieve comments for an issue in Autodesk Construction Cloud projects to track discussions and resolve problems.
Instructions
Retrieves a list of comments associated with an issue in Autodesk Construction Cloud.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | ||
| issueId | Yes |
Implementation Reference
- src/tools/get-issue-comments.ts:15-27 (handler)The async callback function implementing the core logic of the 'get-issue-comments' tool: authenticates, fetches issue comments using IssuesClient, and formats the response.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 the input parameters for the tool: projectId and issueId as non-empty strings.const schema = { projectId: z.string().nonempty(), issueId: z.string().nonempty() };
- src/server.ts:12-14 (registration)Dynamic registration of all tools (including 'get-issue-comments') to the MCP server using a loop over imported tools from './tools/index.js', calling server.tool with title, description, schema, and callback.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-export of the getIssueComments tool from its implementation file, allowing bulk import in src/server.ts.export { getIssueComments } from "./get-issue-comments.js";
- src/tools/get-issue-comments.ts:11-28 (handler)Complete tool object definition for 'get-issue-comments', including title, description, schema reference, and handler callback.export const getIssueComments: Tool<typeof schema> = { title: "get-issue-comments", description: "Retrieves a list of comments associated with an issue in Autodesk Construction Cloud.", schema, 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) })) }; } };