Skip to main content
Glama

List Folders

list_folders
Read-onlyIdempotent

Retrieve a comprehensive list of folders from all accounts, each with its note count.

Instructions

List all folders across all accounts with note counts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
foldersYes

Implementation Reference

  • Registration of the 'list_folders' tool in the MCP server, defining its input/output schemas and the handler that calls listFoldersScript() via JXA and filters shared access.
    server.registerTool(
      "list_folders",
      {
        title: "List Folders",
        description: "List all folders across all accounts with note counts.",
        inputSchema: {},
        outputSchema: {
          folders: z.array(
            z.object({
              id: z.string(),
              name: z.string(),
              account: z.string(),
              noteCount: z.number(),
              shared: z.boolean(),
            }),
          ),
        },
        annotations: {
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: false,
        },
      },
      async () => {
        try {
          const result = await runJxa<FolderItem[]>(listFoldersScript());
          return okStructured({ folders: filterSharedAccess(result, config, "notes") });
        } catch (e) {
          return errJxaFor("list folders", e);
        }
      },
    );
  • The async handler function for list_folders tool: runs the JXA script and returns filtered folders.
    async () => {
      try {
        const result = await runJxa<FolderItem[]>(listFoldersScript());
        return okStructured({ folders: filterSharedAccess(result, config, "notes") });
      } catch (e) {
        return errJxaFor("list folders", e);
      }
    },
  • listFoldersScript() function that returns a JXA script string to list all folders across accounts with their names, note counts, and shared status.
    export function listFoldersScript(): string {
      return `
        const Notes = Application('Notes');
        const accounts = Notes.accounts();
        const result = [];
        for (const acct of accounts) {
          const aName = acct.name();
          const fIds = acct.folders.id();
          const fNames = acct.folders.name();
          const fShared = acct.folders.shared();
          for (let i = 0; i < fIds.length; i++) {
            result.push({
              id: fIds[i],
              name: fNames[i],
              account: aName,
              noteCount: acct.folders[i].notes.length,
              shared: fShared[i]
            });
          }
        }
        JSON.stringify(result);
      `;
    }
  • Output schema for list_folders: an array of folders with id, name, account, noteCount, and shared fields.
    inputSchema: {},
    outputSchema: {
      folders: z.array(
        z.object({
          id: z.string(),
          name: z.string(),
          account: z.string(),
          noteCount: z.number(),
          shared: z.boolean(),
        }),
      ),
    },
Behavior4/5

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

Annotations already declare safe read-only behavior. The description adds value by specifying 'across all accounts' and 'with note counts', providing context beyond the annotations.

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 a single concise sentence that front-loads the action and scope, with no wasted words.

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 is simple with no parameters and an existing output schema, the description sufficiently explains what is returned (folders with note counts), though it could mention that it returns all folders.

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?

The tool has zero parameters, and schema description coverage is 100%. With no parameters, the description adds no parameter-specific info, but the baseline for zero parameters is 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?

The description uses a specific verb 'List' and resource 'folders', and adds scope 'across all accounts' and includes 'note counts', clearly distinguishing it from siblings like 'list_directory' or 'list_notes'.

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

Usage Guidelines3/5

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

The description does not explicitly state when to use this tool versus alternatives. For a simple list tool, the purpose is clear but lacks guidance on exclusions or context.

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/heznpc/AirMCP'

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