Skip to main content
Glama

archy_trend

Retrieves the recent structural health score history from a Python project, ordered oldest-first, to compare changes between snapshots.

Instructions

Read the recent score history (.archy/history.jsonl) for a Python project. Returns up to last_n rows ordered oldest-first so an agent can compare deltas.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
last_nNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Tool registration for 'archy_trend' via @server.tool decorator. Delegates to _run_trend().
    @server.tool(
        name="archy_trend",
        description=(
            "Read the recent score history (.archy/history.jsonl) for a Python "
            "project. Returns up to last_n rows ordered oldest-first so an agent "
            "can compare deltas."
        ),
    )
    def archy_trend(path: str, last_n: int = 10) -> list[TrendRow]:
        return _run_trend(Path(path), last_n=last_n)
  • _run_trend() is the handler that reads history from .archy/history.jsonl and transforms HistoryRow objects into TrendRow response model instances.
    def _run_trend(path: Path, *, last_n: int) -> list[TrendRow]:
        rows = read_history(path / ".archy" / "history.jsonl")
        window = rows[-last_n:] if last_n > 0 else rows
        return [
            TrendRow(
                timestamp=r.timestamp,
                commit=r.commit,
                branch=r.branch,
                score=TrendRowScore(
                    overall=r.overall,
                    modularity=r.modularity,
                    acyclicity=r.acyclicity,
                    depth=r.depth,
                    equality=r.equality,
                ),
                inputs=TrendRowInputs(
                    module_count=r.module_count,
                    edge_count=r.edge_count,
                    cycle_count=r.cycle_count,
                    tangle_ratio=r.tangle_ratio,
                    max_depth=r.max_depth,
                    community_count=r.community_count,
                ),
            )
            for r in window
        ]
  • TrendRowScore, TrendRowInputs, and TrendRow Pydantic models define the output schema for the archy_trend tool.
    class TrendRowScore(BaseModel):
        model_config = ConfigDict(frozen=True)
    
        overall: float
        modularity: float
        acyclicity: float
        depth: float
        equality: float
    
    
    class TrendRowInputs(BaseModel):
        model_config = ConfigDict(frozen=True)
    
        module_count: int
        edge_count: int
        cycle_count: int
        tangle_ratio: float
        max_depth: int
        community_count: int
    
    
    class TrendRow(BaseModel):
        model_config = ConfigDict(frozen=True)
    
        timestamp: str
        commit: str | None
        branch: str | None
        score: TrendRowScore
        inputs: TrendRowInputs
  • read_history() (imported as read_history) reads .archy/history.jsonl and parses JSONL lines into HistoryRow objects.
    def read(history_path: Path) -> list[HistoryRow]:
        if not history_path.exists():
            return []
        rows: list[HistoryRow] = []
        for raw_line in history_path.read_text(encoding="utf-8").splitlines():
            line = raw_line.strip()
            if not line:
                continue
            try:
                data = json.loads(line)
            except json.JSONDecodeError:
                # Malformed lines skipped rather than aborted; the file is
                # append-only and a half-flushed write should not break trend.
                continue
            row = _row_from_dict(data)
            if row is not None:
                rows.append(row)
        return rows
  • HistoryRow Pydantic model - the raw history data format stored in .archy/history.jsonl.
    class HistoryRow(BaseModel):
        model_config = ConfigDict(frozen=True)
    
        timestamp: str  # ISO-8601 UTC, second precision, suffixed Z.
        commit: str | None
        branch: str | None
        overall: float
        modularity: float
        acyclicity: float
        depth: float
        equality: float
        module_count: int
        edge_count: int
        cycle_count: int
        tangle_ratio: float
        max_depth: int
        community_count: int
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It states the tool reads a file, implying read-only behavior, but does not explicitly confirm no side effects, permissions needed, or other behavioral traits. It is adequate but not rich.

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 sentence that conveys all necessary information without fluff. It is front-loaded with the key action and resource, and every phrase adds value.

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 has two simple parameters and an output schema (not shown), the description covers the purpose, return order, and row limit. It does not detail the history.jsonl structure, but the output schema likely handles that. It is nearly complete for a simple read tool.

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 schema description coverage is 0%, but the description adds meaning: it explains that 'last_n' limits the rows returned (up to last_n rows) and that 'path' likely points to the Python project root. This partially compensates for the absent param descriptions.

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 tool reads recent score history from a specific file (.archy/history.jsonl) for a Python project. It specifies the resource and action, and distinguishes from siblings like archy_score and archy_check which serve different purposes.

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 implies the tool is for comparing deltas by returning rows oldest-first, but it does not explicitly state when to use it over siblings, nor does it provide exclusions or alternative tools. The context of siblings is available but unused.

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/hslee16/archy'

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