Skip to main content
Glama

get-accounts

Retrieve a list of all available Autodesk Construction Cloud accounts via the APS MCP Server, enabling access to account details for managing and integrating platform services.

Instructions

List all available Autodesk Construction Cloud accounts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler for the 'get-accounts' tool, which fetches and returns a list of available Autodesk Construction Cloud accounts (hubs) using the DataManagementClient.
    export const getAccounts: Tool<typeof schema> = { title: "get-accounts", description: "List all available Autodesk Construction Cloud accounts", schema, callback: async () => { const accessToken = await getAccessToken(["data:read"]); const dataManagementClient = new DataManagementClient(); const hubs = await dataManagementClient.getHubs({ accessToken }); if (!hubs.data) { throw new Error("No accounts found"); } return { content: hubs.data.map((hub) => ({ type: "text", text: JSON.stringify({ id: hub.id, name: hub.attributes?.name }) })) }; } };
  • Empty schema indicating no input parameters required for the get-accounts tool.
    const schema = {};
  • src/server.ts:12-14 (registration)
    Registers all tools from the tools module, including 'get-accounts', with the MCP server.
    for (const tool of Object.values(tools)) { server.tool(tool.title, tool.description, tool.schema, tool.callback); }
  • src/tools/index.ts:1-1 (registration)
    Re-exports the getAccounts tool object for aggregation in tools/index.ts.
    export { getAccounts } from "./get-accounts.js";
  • Shared helper function to retrieve a cached access token for APS API scopes, used in the get-accounts 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; }

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