get-item-versions
Retrieve all document versions in Autodesk Construction Cloud projects to track changes and access historical data.
Instructions
List all versions of a document in Autodesk Construction Cloud
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | ||
| itemId | Yes |
Implementation Reference
- src/tools/get-item-versions.ts:15-26 (handler)The asynchronous callback function that implements the core logic of the 'get-item-versions' tool. It retrieves an access token, uses the DataManagementClient to fetch item versions from Autodesk Platform Services, and formats the response as MCP content.callback: async ({ projectId, itemId }) => { // TODO: add pagination support const accessToken = await getAccessToken(["data:read"]); const dataManagementClient = new DataManagementClient(); const versions = await dataManagementClient.getItemVersions(projectId, itemId, { accessToken }); if (!versions.data) { throw new Error("No versions found"); } return { content: versions.data.map((version) => ({ type: "text", text: JSON.stringify(version) })) }; }
- src/tools/get-item-versions.ts:6-9 (schema)Zod schema defining the input parameters for the tool: projectId (string, nonempty) and itemId (string, nonempty).const schema = { projectId: z.string().nonempty(), itemId: z.string().nonempty() };
- src/tools/index.ts:4-4 (registration)Re-export of the getItemVersions tool from its module, aggregating it into the tools index for bulk import and registration.export { getItemVersions } from "./get-item-versions.js";
- src/server.ts:12-14 (registration)Generic registration loop that registers all tools (including get-item-versions) from the tools index into the MCP server using server.tool().for (const tool of Object.values(tools)) { server.tool(tool.title, tool.description, tool.schema, tool.callback); }