Skip to main content
Glama

list_facts

List recorded facts from repository memory, with optional filters by tag, source file, or date, to find relevant information before reading full content.

Instructions

List recorded facts, optionally filtered. Useful when you want only facts relevant to a specific area before reading them.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tagNo
source_fileNo
sinceNo
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Core implementation of list_facts — reads facts.jsonl, filters by tag/source_file/since, applies limit, returns list of Fact objects.
    def list_facts(root: Path, *, tag: str | None = None, source_file: str | None = None,
                   since: str | None = None, limit: int | None = None) -> list[Fact]:
        path = _memdir(root) / FACTS_FILE
        if not path.exists():
            return []
        out: list[Fact] = []
        for line in path.read_text(encoding="utf-8").splitlines():
            line = line.strip()
            if not line:
                continue
            try:
                data = json.loads(line)
            except json.JSONDecodeError:
                continue
            f = Fact(**{k: data.get(k) for k in ("id", "ts", "claim", "evidence", "tags", "added_by")})
            f.evidence = f.evidence or {}
            f.tags = f.tags or []
            if tag and tag not in f.tags:
                continue
            if source_file and (f.evidence or {}).get("file") != source_file:
                continue
            if since and f.ts < since:
                continue
            out.append(f)
        if limit:
            out = out[-limit:]
        return out
  • MCP tool handler for list_facts — decorated with @mcp.tool(), delegates to store.list_facts and returns dict representations.
    @mcp.tool()
    def list_facts(tag: str | None = None, source_file: str | None = None,
                   since: str | None = None, limit: int = 20) -> list[dict]:
        """List recorded facts, optionally filtered. Useful when you want only
        facts relevant to a specific area before reading them."""
        facts = store.list_facts(_REPO_ROOT, tag=tag, source_file=source_file,
                                 since=since, limit=limit)
        return [f.__dict__ for f in facts]
  • Fact dataclass — the return type used by list_facts, with id, ts, claim, evidence, tags, added_by fields.
    @dataclass
    class Fact:
        id: str
        ts: str
        claim: str
        evidence: dict = field(default_factory=dict)
        tags: list[str] = field(default_factory=list)
        added_by: str | None = None
  • Registration of list_facts as an MCP tool via @mcp.tool() decorator on the handler function.
    @mcp.tool()
    def list_facts(tag: str | None = None, source_file: str | None = None,
                   since: str | None = None, limit: int = 20) -> list[dict]:
        """List recorded facts, optionally filtered. Useful when you want only
        facts relevant to a specific area before reading them."""
        facts = store.list_facts(_REPO_ROOT, tag=tag, source_file=source_file,
                                 since=since, limit=limit)
        return [f.__dict__ for f in facts]
  • CLI subcommand registration for list-facts with argument definitions (--tag, --source-file, --since, --limit, --json).
    p_list_facts = sub.add_parser("list-facts", help="List facts, with optional filters.")
    _add_root_arg(p_list_facts)
    p_list_facts.add_argument("--tag")
    p_list_facts.add_argument("--source-file")
    p_list_facts.add_argument("--since", help="ISO timestamp (UTC).")
    p_list_facts.add_argument("--limit", type=int)
    p_list_facts.add_argument("--json", action="store_true", help="Emit JSON instead of table.")
Behavior3/5

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

No annotations are provided, so the description must convey behavior. It indicates a read operation ('List') with optional filtering, but does not disclose pagination, ordering, or any side effects. Given the simplicity, a score of 3 is acceptable.

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 with no extraneous information. The purpose is immediately stated, and the usage hint is brief. Perfect conciseness.

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

Completeness2/5

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

Despite having an output schema, the description lacks details on filter parameters and return structure. For a tool with four optional parameters, the description is insufficient for an agent to correctly construct calls without additional context.

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

Parameters1/5

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

With 0% schema description coverage, the description should compensate by explaining parameters. It only says 'optionally filtered' but does not mention 'tag', 'source_file', 'since', or 'limit', leaving the agent without guidance on how to use filters.

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 explicitly states 'List recorded facts', clearly identifying the action and resource. It distinguishes from sibling tools like 'add_fact' and 'add_decision' which are write operations.

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 a clear use case: 'Useful when you want only facts relevant to a specific area before reading them.' It implies filtering but does not specify when not to use or alternatives, though the context is adequate.

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/yubinkim444/repo-memory'

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