Skip to main content
Glama

Graph Compact

graph_compact
Read-onlyIdempotent

Shrink a memory to the part that still earns its place. PREMIUM (license).

Ranks entities by how connected they are and how much is recorded about them, keeps anything you name outright, and drops the rest along with the relations that pointed at them. Typical input {"graph": {...}, "max_entities": 50, "keep": ["Acme Corp"]} returns {"graph": {...}, "kept": 50, "dropped_entities": ["Old Note", ...], "dropped_relations": 12, "ranking": "degree, then observation count, then name"}.

Use when a graph has outgrown the context you can spend on it. Not for removing wrong facts - graph_lint finds those, and deleting them is a decision you should make deliberately rather than by ranking. Errors: on invalid, missing, or malformed input this tool never raises a protocol error — it returns {"error": ""}. Every call is read-only and idempotent, so after correcting the input it is always safe to retry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keepNoEntity names to keep regardless of rank, e.g. ["Acme Corp"]. Matched case-insensitively.
graphYesThe graph document to compact.
max_entitiesNoHow many entities to keep. Default 50.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

TDQS

A4.9/5.0
Behavior5/5

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

Beyond the annotations (readOnlyHint, idempotentHint, destructiveHint), the description adds substantial behavioral context: the ranking criteria ('degree, then observation count, then name'), the response shape with kept/dropped counts, that it never raises protocol errors but returns an error object, and that retries are safe after input correction. This is rich, non-redundant transparency.

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 dense but remarkably efficient: a one-sentence purpose, a concrete example, usage boundaries, and error behavior. Every sentence adds information; there is no filler or repetition of the schema, and the most important points are front-loaded.

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?

Given the rich annotations, full schema coverage, and output schema, the description still manages to fill all important gaps: return format, ranking algorithm, error semantics, idempotence reassurance, and a realistic usage example. There is no missing context an agent would need for correct invocation.

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 input schema already documents all three parameters (graph, max_entities, keep) with descriptions, defaults, and constraints, so the baseline is high. The description adds meaningful usage semantics by showing a typical input/output example and explaining what 'keep' means behaviorally ('keeps anything you name outright') and how ranking works, which goes beyond the schema's mechanical definitions.

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 defines the tool as 'Shrink a memory to the part that still earns its place' and details exactly what happens: ranking entities, keeping named ones, and dropping the rest with their relations. It explicitly distinguishes this from sibling tools like graph_lint, which is for finding wrong facts.

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?

The description gives explicit when-to-use guidance ('Use when a graph has outgrown the context you can spend on it') and when-not-to-use guidance ('Not for removing wrong facts - graph_lint finds those'). It also names the alternative tool, making the usage boundary crisp.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A4.9/5.0
Disambiguation5/5

Each tool has a distinct, non-overlapping purpose: time-based query, compaction, diff, lint, search, and upsert. No ambiguity between them.

Naming Consistency5/5

All tools follow a consistent 'graph_' prefix with descriptive verb suffixes, forming a clear and predictable naming pattern.

Tool Count5/5

Six tools is an appropriate number for a memory graph server, covering all essential operations without redundancy or bloat.

Completeness5/5

The toolset provides full coverage: upsert for writing, search and at_time for reading, diff for change tracking, lint for validation, and compact for maintenance. No gaps.

Resources