Skip to main content
Glama

aps_get_folder_tree

Visualize folder hierarchies and file counts in Autodesk Platform Services projects to understand project organization. Specify project and folder IDs with optional depth control.

Instructions

Build a recursive folder‑tree structure showing subfolder hierarchy and file counts per folder. Useful for understanding a project's organisation at a glance. ⚠️ Each level makes an API call, so keep max_depth low (default 3) to avoid rate limits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID – starts with 'b.'.
folder_idYesRoot folder URN – starts with 'urn:'.
max_depthNoMaximum recursion depth (1‑5). Default 3.

Implementation Reference

  • The handler for 'aps_get_folder_tree' in src/index.ts. It validates input parameters and calls the helper function 'buildFolderTree'.
    // ── aps_get_folder_tree ──────────────────────────────────────
    if (name === "aps_get_folder_tree") {
      const projectId = args.project_id as string;
      const folderId = args.folder_id as string;
      const e1 = validateProjectId(projectId);
      if (e1) return fail(e1);
      const e2 = validateFolderId(folderId);
      if (e2) return fail(e2);
    
      const maxDepth = Math.min(Math.max(Number(args.max_depth) || 3, 1), 5);
      const t = await token();
      const tree = await buildFolderTree(projectId, folderId, t, maxDepth);
      return json(tree);
    }
  • The implementation of the recursive folder tree builder. It fetches contents, handles depth limits, and constructs the tree structure.
    export async function buildFolderTree(
      projectId: string,
      folderId: string,
      token: string,
      maxDepth: number = 3,
      _currentDepth: number = 0,
    ): Promise<FolderTreeNode> {
      const path = `data/v1/projects/${projectId}/folders/${encodeURIComponent(folderId)}/contents`;
      const raw = (await apsDmRequest("GET", path, token, {
        query: { "page[limit]": "200" },
      })) as Record<string, unknown>;
      const data = Array.isArray(raw.data) ? (raw.data as Record<string, unknown>[]) : [];
    
      const childFolders: FolderTreeNode[] = [];
      let fileCount = 0;
    
      for (const item of data) {
        const attrs = item.attributes as Record<string, unknown> | undefined;
        if (item.type === "folders") {
          if (_currentDepth < maxDepth - 1) {
            const child = await buildFolderTree(
              projectId,
              item.id as string,
              token,
              maxDepth,
              _currentDepth + 1,
            );
            child.name = (attrs?.displayName as string) ?? "(unknown)";
            childFolders.push(child);
          } else {
            childFolders.push({
              name: (attrs?.displayName as string) ?? "(unknown)",
              id: item.id as string,
              type: "folder",
              // max depth reached – children not fetched
            });
          }
        } else {
          fileCount++;
        }
      }
    
      // Resolve folder name at the root level of the call
      let folderName = folderId;
      if (_currentDepth === 0) {
        try {
          const folderRaw = (await apsDmRequest(
            "GET",
            `data/v1/projects/${projectId}/folders/${encodeURIComponent(folderId)}`,
            token,
          )) as Record<string, unknown>;
          const fAttrs = (folderRaw.data as Record<string, unknown>)?.attributes as
            | Record<string, unknown>
            | undefined;
          folderName = (fAttrs?.displayName as string) ?? folderId;
        } catch {
          // keep folderId as name
        }
      }
    
      return {
        name: folderName,
        id: folderId,
        type: "folder",
        children: childFolders.length > 0 ? childFolders : undefined,
        file_count: fileCount,
      };
    }
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: the recursive nature ('Each level makes an API call'), performance implications ('keep max_depth low'), and rate limit risks ('to avoid rate limits'), which are not covered by the input schema alone.

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?

The description is front-loaded with the core purpose, followed by usage context and a critical warning, with no wasted words. Every sentence adds value: the first defines the tool, the second explains its utility, and the third provides essential behavioral guidance.

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

Completeness4/5

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

Given the tool's moderate complexity (recursive tree building), lack of annotations, and no output schema, the description is largely complete for guiding usage. It covers purpose, utility, and key behavioral constraints, though it could benefit from clarifying the output format (e.g., tree structure details) since no output schema is provided.

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

Parameters3/5

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

The input schema has 100% description coverage, providing clear details for all parameters. The description adds minimal value beyond the schema, only mentioning the default for max_depth (which is also in the schema) and implying its impact on API calls, but does not explain parameter interactions or provide additional semantic context.

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?

The description clearly states the tool's purpose with specific verbs ('build a recursive folder-tree structure') and resources ('subfolder hierarchy and file counts per folder'), distinguishing it from sibling tools like aps_get_folder_contents (which likely lists items without hierarchy) and aps_get_top_folders (which likely shows top-level only).

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?

The description provides clear context for when to use it ('useful for understanding a project's organisation at a glance') and includes a practical constraint ('keep max_depth low to avoid rate limits'), but does not explicitly state when not to use it or name specific alternatives among the sibling tools.

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/ACC.MCP'

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