Skip to main content
Glama
sifter-ai

sifter-mcp

Official

list_folders

Retrieve folder names and their document counts with pagination support for browsing structured document collections.

Instructions

List folders with their name and document count.

Args:
    limit: Maximum number of folders to return (default 100, max 200)
    offset: Number of folders to skip for pagination

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
offsetNo

Implementation Reference

  • The MCP tool handler for 'list_folders'. Calls the async SDK client's list_folders method and returns paginated folder data.
    @mcp.tool()
    async def list_folders(limit: int = 100, offset: int = 0) -> dict:
        """List folders with their name and document count.
    
        Args:
            limit: Maximum number of folders to return (default 100, max 200)
            offset: Number of folders to skip for pagination
        """
        async with _get_client() as client:
            page = await client.list_folders(limit=min(limit, 200), offset=offset)
        return {"items": [h._data for h in page.items], "total": page.total, "limit": page.limit, "offset": page.offset}
  • The @mcp.tool() decorator registers this function as the 'list_folders' MCP tool.
    @mcp.tool()
  • Async SDK client method that calls the REST API GET /api/folders and returns paginated FolderHandle objects.
    async def list_folders(self, limit: int = 200, offset: int = 0) -> Page:
        async with httpx.AsyncClient() as http:
            r = await http.get(
                f"{self.api_url}/api/folders",
                headers=self._auth_headers(),
                params={"limit": limit, "offset": offset},
            )
            r.raise_for_status()
            data = r.json()
        raw = data if isinstance(data, list) else data.get("items", [])
        items = [AsyncFolderHandle(item, self) for item in raw]
        total = len(raw) if isinstance(data, list) else data.get("total", 0)
        return Page(items=items, total=total, limit=data.get("limit", limit) if isinstance(data, dict) else limit,
                    offset=data.get("offset", offset) if isinstance(data, dict) else offset,
                    next_cursor=data.get("next_cursor") if isinstance(data, dict) else None)
  • Sync SDK client method that calls the REST API GET /api/folders and returns paginated FolderHandle objects.
    def list_folders(self, limit: int = 200, offset: int = 0) -> "Page":
        """Return one page of folders as FolderHandle objects."""
        import httpx
        with httpx.Client() as http:
            r = http.get(
                f"{self.api_url}/api/folders",
                headers=self._auth_headers(),
                params={"limit": limit, "offset": offset},
            )
            r.raise_for_status()
            data = r.json()
        raw = data if isinstance(data, list) else data.get("items", [])
        items = [FolderHandle(item, self) for item in raw]
        total = len(raw) if isinstance(data, list) else data.get("total", 0)
        return Page(items=items, total=total, limit=data.get("limit", limit) if isinstance(data, dict) else limit,
                    offset=data.get("offset", offset) if isinstance(data, dict) else offset,
                    next_cursor=data.get("next_cursor") if isinstance(data, dict) else None)
  • Server-side REST API endpoint GET /api/folders that handles the HTTP request and delegates to DocumentService.list_folders.
    @router.get("")
    async def list_folders(
        limit: int = 200,
        offset: int = 0,
        parent_id: Optional[str] = None,
        all: bool = True,
        principal: Principal = Depends(get_current_principal),
        db=Depends(get_db),
    ):
        """List folders. By default returns all folders (flat).
        Pass ?all=false&parent_id=root for root-level folders.
        Pass ?all=false&parent_id={id} for direct children."""
        svc = DocumentService(db)
        if all:
            folders, total = await svc.list_folders(skip=offset, limit=limit, parent_id="ALL", org_id=principal.org_id)
        elif parent_id == "root":
            folders, total = await svc.list_folders(skip=offset, limit=limit, parent_id=None, org_id=principal.org_id)
        else:
            folders, total = await svc.list_folders(skip=offset, limit=limit, parent_id=parent_id, org_id=principal.org_id)
        return paginated([_folder_dict(f) for f in folders], total, limit, offset)
Behavior2/5

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

No annotations are provided, so the description should carry the full burden. It fails to mention that this is a read-only operation, any required permissions, sorting behavior, or return format beyond a vague mention of name and count. The transparency is low.

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

Conciseness4/5

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

The description is short and front-loaded with the main purpose. The parameter documentation is included as bullet points, but the docstring format adds minor verbosity. Overall efficient with no wasted words.

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

Completeness3/5

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

Given the tool's simplicity (2 parameters, list operation), the description covers the basics. However, it lacks detail on output structure (e.g., whether list is sorted, hierarchical, or flat) and does not mention any limitations. Adequate but not thorough.

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 parameter descriptions add clear meaning beyond the schema: they specify defaults, max limit, and purpose of offset for pagination. This compensates for the 0% schema description coverage.

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 verb 'List' and the resource 'folders', and specifies the output includes 'name and document count'. This distinguishes it from sibling tools like 'get_folder' which likely returns a single folder, and other list tools targeting different resources.

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?

Usage is implied: use to list folders. But no explicit guidance on when to use this vs alternatives or prerequisites. The pagination parameters are described, providing minimal contextual usage hints.

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/sifter-ai/sifter'

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