Skip to main content
Glama

aps_get_token

Obtain a 2-legged access token for Autodesk Platform Services to verify credential configuration. Cached and auto-refreshed by other tools.

Instructions

Get a 2‑legged access token for Autodesk Platform Services (APS). Use this to verify that credentials are configured correctly. The token is cached and auto‑refreshed by all other tools, so you rarely need to call this explicitly.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the 'aps_get_token' tool logic. It calls the internal token() function which prefers a cached 3-legged token, falling back to a 2-legged token via getApsToken(), then returns a success message with the token length.
    // ── aps_get_token ────────────────────────────────────────────
    if (name === "aps_get_token") {
      const t = await token();
      return ok(
        `2‑legged token obtained (length ${t.length}). ` +
        "All other tools use this token automatically – you don't need to pass it.",
      );
    }
  • The input schema definition for 'aps_get_token'. It declares the tool name, description, and input schema (empty object, no parameters required).
    // 1 ── aps_get_token
    {
      name: "aps_get_token",
      description:
        "Get a 2‑legged access token for Autodesk Platform Services (APS). " +
        "Use this to verify that credentials are configured correctly. " +
        "The token is cached and auto‑refreshed by all other tools, so you rarely need to call this explicitly.",
      inputSchema: { type: "object" as const, properties: {} },
    },
  • src/index.ts:1588-1588 (registration)
    The tool is registered in the TOOLS array (which is passed to ListToolsRequestSchema handler), making 'aps_get_token' available as an MCP tool.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
  • The internal token() helper function used by the handler. Prefers a valid 3-legged token (user context) via getValid3loToken(), otherwise falls back to a 2-legged (app context) token via getApsToken() from aps-auth.ts.
    async function token(): Promise<string> {
      requireApsEnv();
      const three = await getValid3loToken(APS_CLIENT_ID, APS_CLIENT_SECRET);
      if (three) return three;
      return getApsToken(APS_CLIENT_ID, APS_CLIENT_SECRET, APS_SCOPE || undefined);
    }
  • The core getApsToken() function that obtains a 2-legged OAuth access token from APS. It uses client credentials grant, caches the token in memory until near expiry, and defaults to 'data:read' scope.
    export async function getApsToken(
      clientId: string,
      clientSecret: string,
      scope?: string
    ): Promise<string> {
      const effectiveScope = (scope?.trim() || DEFAULT_SCOPE);
      const now = Date.now();
      if (
        cachedToken &&
        cachedToken.expiresAt > now + 60_000 &&
        cachedToken.scope === effectiveScope
      ) {
        return cachedToken.token;
      }
    
      const body = new URLSearchParams({
        grant_type: "client_credentials",
        client_id: clientId,
        client_secret: clientSecret,
        scope: effectiveScope,
      });
    
      const res = await fetch(APS_TOKEN_URL, {
        method: "POST",
        headers: { "Content-Type": "application/x-www-form-urlencoded" },
        body: body.toString(),
      });
    
      if (!res.ok) {
        const text = await res.text();
        throw new Error(`APS token failed (${res.status}): ${text}`);
      }
    
      const data = (await res.json()) as ApsTokenResponse;
      cachedToken = {
        token: data.access_token,
        expiresAt: now + (data.expires_in - 60) * 1000,
        scope: effectiveScope,
      };
      return data.access_token;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, description carries the burden. It mentions caching and auto-refresh by other tools, providing behavioral context. However, it lacks details like rate limits or whether repeated calls cause issues.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no wasted words. Purpose is front-loaded, followed by actionable usage guidance. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given zero parameters, no output schema, and simple behavior, the description fully covers purpose, usage context, and relationship to siblings. No gaps remain.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters, so schema coverage is 100%. Description adds value by explaining the purpose and usage context beyond the empty schema, earning the baseline of 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states it gets a 2-legged access token for Autodesk Platform Services, and explicitly distinguishes itself from sibling tools by noting that other tools cache and auto-refresh the token.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says to use for verifying credentials and that it's rarely needed otherwise. Implicitly names alternatives (all other tools handle token management) but does not name a specific sibling.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/EverseDevelopment/APS.MCP'

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