Skip to main content
Glama

unpin_memory

Unpin a memory chunk to re-enable automatic data tiering based on access patterns.

Instructions

Remove the manual pin from a chunk, allowing normal tiering.

    The chunk stays in the hot tier until the next maintenance run, after
    which it will be promoted or demoted based on its access history.

    Args:
        chunk_id: Stable chunk identifier ``<path>:<chunk_index>``.

    Returns:
        Confirmation dict with ``chunk_id`` and ``pinned`` fields.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chunk_idYes

Implementation Reference

  • MCP tool handler function for 'unpin_memory'. Accepts a chunk_id, checks access permission ('index'), validates that tiered memory is enabled, calls ctx.tiered_memory.unpin(chunk_id), logs the query via audit logger, and returns a confirmation dict with pinned=False.
    @mcp.tool()
    def unpin_memory(
        chunk_id: Annotated[
            str,
            "The chunk identifier to unpin, in '<absolute_path>:<chunk_index>' format.",
        ],
    ) -> dict:
        """Remove the manual pin from a chunk, allowing normal tiering.
    
        The chunk stays in the hot tier until the next maintenance run, after
        which it will be promoted or demoted based on its access history.
    
        Args:
            chunk_id: Stable chunk identifier ``<path>:<chunk_index>``.
    
        Returns:
            Confirmation dict with ``chunk_id`` and ``pinned`` fields.
        """
        from memorymesh.server.auth_guard import check_access
    
        if (err := check_access(ctx, "index")) is not None:
            return err
    
        if ctx.tiered_memory is None:
            return {"error": "Memory tiers are not enabled in the current configuration."}
        ctx.tiered_memory.unpin(chunk_id)
        ctx.audit_logger.log_query(
            tool="unpin_memory",
            query=chunk_id,
            n_results=0,
            latency_ms=0.0,
        )
        return {"chunk_id": chunk_id, "pinned": False}
  • Registration of the pin_memory module (which contains both pin_memory and unpin_memory tools) onto the FastMCP server instance.
    pin_memory.register(mcp, ctx)
  • Input schema for the unpin_memory tool: requires a single 'chunk_id' string parameter in '<absolute_path>:<chunk_index>' format.
    chunk_id: Annotated[
        str,
        "The chunk identifier to unpin, in '<absolute_path>:<chunk_index>' format.",
    ],
  • The TieredMemoryManager.unpin() method called by the handler. Retrieves the existing chunk tier record, sets pinned=False while preserving all other fields, persists to metadata store, and logs the action.
    def unpin(self, chunk_id: str) -> None:
        """Remove the manual pin from *chunk_id*, allowing normal demotion.
    
        The chunk remains in hot tier until the next maintenance run.
    
        Args:
            chunk_id: ``<path>:<chunk_index>`` stable identifier.
        """
        existing = self._store.get_chunk_tier(chunk_id)
        if existing is None:
            return
        record = ChunkTierRecord(
            chunk_id=chunk_id,
            tier=existing.tier,
            last_accessed=existing.last_accessed,
            access_count=existing.access_count,
            pinned=False,
        )
        self._store.set_chunk_tier(record)
        logger.info(f"TieredMemory: unpinned chunk {chunk_id!r}")
Behavior4/5

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

No annotations provided, so description carries full burden. It reveals that the chunk stays in hot tier until next maintenance run, which is additional behavioral insight beyond just the action. No contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is clear and well-structured with Args/Returns sections. Slightly wordy but front-loaded with the main action. Efficient for the complexity.

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?

With only one parameter and no output schema, the description fully covers input format and return type. It also explains the behavioral effect on tiering, making it complete for this simple 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?

Schema coverage is 0% despite one parameter, but the description includes a docstring for 'chunk_id' with format '<path>:<chunk_index>', adding value beyond the schema's minimal type definition.

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 uses specific verb 'Remove' and identifies the resource ('chunk'), clearly stating the action of unpinning. It distinguishes from sibling tool pin_memory by contrasting the operation.

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?

Description implies when to use (to reverse a pin) but lacks explicit exclusions or alternatives beyond pin_memory. Mentions the effect on tiering, which provides context.

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