get-projects
Retrieve a list of all projects in your Autodesk Construction Cloud account to manage construction data and workflows efficiently.
Instructions
List all available projects in an Autodesk Construction Cloud account
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accountId | Yes |
Implementation Reference
- src/tools/get-projects.ts:14-28 (handler)The asynchronous callback function that executes the core logic of the 'get-projects' tool. It authenticates using getAccessToken, initializes DataManagementClient, retrieves projects for the specified accountId, and returns a content array with JSON-formatted project details.
callback: async ({ accountId }) => { // TODO: add pagination support const accessToken = await getAccessToken(["data:read"]); const dataManagementClient = new DataManagementClient(); const projects = await dataManagementClient.getHubProjects(accountId, { accessToken }); if (!projects.data) { throw new Error("No projects found"); } return { content: projects.data.map((project) => ({ type: "text", text: JSON.stringify({ id: project.id, name: project.attributes?.name }) })) }; } - src/tools/get-projects.ts:6-8 (schema)Zod schema defining the input parameters for the tool, specifically requiring a non-empty string for 'accountId'.
const schema = { accountId: z.string().nonempty() }; - src/server.ts:11-14 (registration)Creates the MCP server instance and registers all tools (including 'get-projects') imported from './tools/index.js' using a loop over Object.values(tools), passing title, description, schema, and callback to server.tool().
const server = new McpServer({ name: "autodesk-platform-services", version: "0.0.1" }); for (const tool of Object.values(tools)) { server.tool(tool.title, tool.description, tool.schema, tool.callback); } - src/tools/index.ts:2-2 (registration)Re-exports the getProjects tool from its implementation file, making it available for bulk import in server.ts via './tools/index.js'.
export { getProjects } from "./get-projects.js";