Skip to main content
Glama

get-projects

Retrieve a list of all available projects within an Autodesk Construction Cloud account using the APS MCP Server. Simplify project management and access control by querying relevant project data.

Instructions

List all available projects in an Autodesk Construction Cloud account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYes

Implementation Reference

  • Handler function that authenticates using getAccessToken and retrieves projects for the specified accountId using Autodesk Platform Services DataManagementClient.
    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 }) })) }; }
  • Zod schema for input validation, requiring a non-empty string accountId.
    const schema = { accountId: z.string().nonempty() };
  • src/server.ts:12-14 (registration)
    Registers all tools from the tools module, including 'get-projects', with the MCP server by calling server.tool for each.
    for (const tool of Object.values(tools)) { server.tool(tool.title, tool.description, tool.schema, tool.callback); }
  • src/tools/index.ts:2-2 (registration)
    Barrel export that includes the getProjects tool in the tools index for server import.
    export { getProjects } from "./get-projects.js";
  • Shared helper function used by the handler to obtain and cache APS access tokens based on scopes.
    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; }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/petrbroz/aps-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server