Skip to main content
Glama

list_sources

View indexed source directories with file counts, chunk totals, and disk usage to monitor indexing status.

Instructions

List all configured source directories with indexing statistics.

    Returns a summary for each source: file counts by status, total chunk
    count, and aggregate disk size.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for list_sources. Iterates over configured sources, queries the metadata store for file records, computes indexing statistics (indexed/pending/errored counts, chunk count, disk size, last scan), logs the query, and returns the aggregated results.
    @mcp.tool()
    def list_sources() -> dict:
        """List all configured source directories with indexing statistics.
    
        Returns a summary for each source: file counts by status, total chunk
        count, and aggregate disk size.
        """
        from memorymesh.server.auth_guard import check_access
    
        if (err := check_access(ctx, "read")) is not None:
            return err
    
        t0 = time.perf_counter()
    
        sources_out = []
        for src_cfg in ctx.config.sources:
            name = src_cfg.name or str(src_cfg.path)
    
            all_records = ctx.metadata_store.list_files()
            matching = [r for r in all_records if r.source_name == name]
    
            n_indexed = sum(1 for r in matching if r.status == "indexed")
            n_pending = sum(1 for r in matching if r.status == "pending_reindex")
            n_errored = sum(1 for r in matching if r.status == "parse_error")
            total_chunks = sum(r.n_chunks for r in matching if r.status == "indexed")
            disk_bytes = sum(r.size_bytes for r in matching)
            last_scan = max((r.indexed_at for r in matching), default=None)
    
            sources_out.append(
                {
                    "name": name,
                    "path": str(src_cfg.path),
                    "recursive": src_cfg.recursive,
                    "n_files_indexed": n_indexed,
                    "n_files_pending": n_pending,
                    "n_files_errored": n_errored,
                    "total_chunks": total_chunks,
                    "disk_size_bytes": disk_bytes,
                    "last_scan_at": last_scan,
                }
            )
    
        latency_ms = (time.perf_counter() - t0) * 1000
        ctx.audit_logger.log_query(
            tool="list_sources",
            query="list_sources",
            n_results=len(sources_out),
            latency_ms=latency_ms,
        )
    
        return {"sources": sources_out, "duration_ms": round(latency_ms, 2)}
  • Registration of the list_sources tool on the FastMCP instance via its register function.
    search_memory.register(mcp, ctx)
    list_sources.register(mcp, ctx)
  • Database-backed helper method in FileRepository that lists all source rows from the 'sources' table.
    def list_sources(self) -> list[dict[str, object]]:
        """Return all source rows as plain dicts."""
        rows = self._conn().execute("SELECT * FROM sources").fetchall()
        return [dict(r) for r in rows]
  • Delegation method in MetadataStore that calls through to FileRepository.list_sources().
    def list_sources(self) -> list[dict[str, object]]:
        """Return all source rows as plain dicts."""
        return self._files.list_sources()
Behavior3/5

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

No annotations are provided, so the description carries the burden. It discloses the return format (file counts, chunk count, disk size) but does not mention any side effects, performance characteristics, or data freshness. For a read-only listing, this is minimally adequate.

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 concise with two sentences, front-loading the main purpose and then detailing the return summary. No unnecessary 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 no parameters and no output schema, the description provides a good overview of what the tool returns. However, it does not specify whether results are paginated or if there is a limit, which could be relevant for many sources.

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?

There are no parameters, so the schema provides full coverage. The description does not add extra meaning beyond the schema, but that is acceptable. 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 clearly states it lists configured source directories with indexing statistics, using specific verb and resource. It distinguishes itself from sibling tools that perform memory or modification operations.

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?

No explicit when-to-use or when-not-to-use guidance is provided. While the context implies use for overview of sources, there is no comparison with sibling tools like 'summarize_source' or 'sync_source'.

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/kilhubprojects/memory-mesh'

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