Skip to main content
Glama

get_summary

Retrieve the project memory summary to avoid re-reading source files. Call this before answering any project question to ensure accurate and efficient responses.

Instructions

Read the project memory summary.

MANDATORY: call this BEFORE answering ANY question about the project.

Do NOT answer from conversation history alone.
Do NOT re-scan source files (package.json, README, src/) to understand
the project — `summary.md` is the distilled authoritative source and
costs ~500 tokens versus ~5,000 to re-derive.

Your prior assumptions about this project may be stale. Call this
cheaply at session start (and again before ending) to verify your
work is recorded.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The get_summary MCP tool handler. Reads and returns the .projectmem/summary.md file contents, or returns a fallback message if the file doesn't exist. Decorated with @mcp.tool() for registration and @safe_tool for exception+stdout safety.
    @mcp.tool()
    @safe_tool
    def get_summary() -> str:
        """Read the project memory summary.
    
        MANDATORY: call this BEFORE answering ANY question about the project.
    
        Do NOT answer from conversation history alone.
        Do NOT re-scan source files (package.json, README, src/) to understand
        the project — `summary.md` is the distilled authoritative source and
        costs ~500 tokens versus ~5,000 to re-derive.
    
        Your prior assumptions about this project may be stale. Call this
        cheaply at session start (and again before ending) to verify your
        work is recorded."""
        path = summary_path()
        if path.exists():
            return path.read_text(encoding="utf-8")
        return "No summary found. Run `pjm init` first."
  • The @mcp.tool() decorator registers get_summary as an MCP tool on the FastMCP server instance.
    @mcp.tool()
  • Helper that resolves the path to .projectmem/summary.md by calling require_mem_dir(). The SUMMARY_FILE constant is 'summary.md'.
    def summary_path(root: Path | None = None) -> Path:
        return require_mem_dir(root) / SUMMARY_FILE
  • Helper that locates the .projectmem directory from an explicit root, CWD, or by walking up the directory tree. Raises ProjectMemError if not found.
    def require_mem_dir(root: Path | None = None) -> Path:
        # If an explicit root was given, honor only that root (back-compat).
        if root is not None:
            path = mem_path(root)
            if path.exists():
                return path
            raise ProjectMemError(
                f"No .projectmem directory found in {root}. Run `projectmem init`."
            )
    
        # No explicit root: try CWD first, then walk up the directory tree.
        cwd_path = mem_path(None)
        if cwd_path.exists():
            return cwd_path
        found = discover_mem_dir(None)
        if found is not None:
            return found
        raise ProjectMemError(
            f"No .projectmem directory found in {Path.cwd()} or any parent. "
            f"If running over MCP, set the project root via the `cwd` field in your "
            f"MCP client config or via the PROJECTMEM_ROOT environment variable. "
            f"Otherwise run `projectmem init` to create one."
        )
  • Decorator that wraps tool functions to suppress stdout (to prevent JSON-RPC pollution) and catch exceptions (to prevent connection crashes). Applied to get_summary.
    def safe_tool(fn: Callable) -> Callable:
        """Wrap a tool so exceptions become text the AI can read and recover from.
    
        Every tool body also runs inside ``_suppress_stdout``. Combined, these
        two layers guarantee:
          - JSON-RPC stdio is never polluted (L-009)
          - A single tool failure never tears down the session (L-010)
        """
        @functools.wraps(fn)
        def wrapper(*args, **kwargs):
            try:
                with _suppress_stdout():
                    return fn(*args, **kwargs)
            except Exception as exc:  # pragma: no cover - defensive
                return f"projectmem tool error: {type(exc).__name__}: {exc}"
        return wrapper
Behavior5/5

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

With no annotations, description fully discloses it's a read operation, costs ~500 tokens, should be called cheaply at session start and before ending, and warns that prior assumptions may be stale.

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?

All sentences are purposeful, front-loaded with main action, followed by mandatory usage, rationale, and behavioral notes. No wasted words.

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

Completeness5/5

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

Covers purpose, mandatory usage, cost, timing, and staleness warning. Despite no annotations or param details, the description is sufficient for an agent to use correctly.

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?

No parameters exist; schema coverage is 100%. Description doesn't need to add param info. Baseline 4 for zero-param case.

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?

Clearly states 'Read the project memory summary.' and distinguishes from siblings like get_context and get_global_gotchas by emphasizing it as the distilled authoritative source.

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

Usage Guidelines5/5

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

Explicitly says 'MANDATORY: call this BEFORE answering ANY question about the project.' and provides when-not-use instructions: 'Do NOT answer from conversation history alone. Do NOT re-scan source files...'

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/riponcm/projectmem'

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