Skip to main content
Glama

Pin or unpin a memory

memory_pin
Idempotent

Toggle the pinned status of a memory to protect it from pruning and boost its search ranking. Pin only high-leverage facts and decisions; overuse diminishes effectiveness.

Instructions

Toggle the pinned flag — pinned memories survive pruning and rank higher in search. Idempotent. Use sparingly: reserve pins for canonical decisions, user preferences, and high-leverage facts. Pinning everything defeats the purpose.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memory_idYesId of the memory to pin or unpin.
pinnedNo`true` (default) to pin, `false` to unpin.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYes`Memory <id> pinned.` / `Memory <id> unpinned.` on success, `Memory <id> not found.` when missing.

Implementation Reference

  • Handler function that pins or unpins a memory by calling repo.setPinned(). Returns a human-readable result string.
    export async function handleMemoryPin(
      repo: MemoriesRepo,
      params: { memory_id: string; pinned: boolean },
    ): Promise<string> {
      const ok = repo.setPinned(params.memory_id, params.pinned);
      if (!ok) {
        return `Memory not found: ${params.memory_id}`;
      }
      return params.pinned
        ? `Memory pinned: ${params.memory_id}`
        : `Memory unpinned: ${params.memory_id}`;
    }
  • Input schema: memory_id (required string) and pinned (optional boolean, default true).
    inputSchema: {
      memory_id: z.string().min(1).describe("Id of the memory to pin or unpin."),
      pinned: z.boolean().default(true).describe("`true` (default) to pin, `false` to unpin."),
    },
  • Output schema: returns a message string.
    outputSchema: {
      message: z.string().describe("`Memory <id> pinned.` / `Memory <id> unpinned.` on success, `Memory <id> not found.` when missing."),
    },
  • src/index.ts:570-594 (registration)
    Tool registration with MCP server under the name 'memory_pin'.
    server.registerTool(
      "memory_pin",
      {
        title: "Pin or unpin a memory",
        description: [
          "Toggle the pinned flag — pinned memories survive pruning and rank higher in search. Idempotent.",
          "Use sparingly: reserve pins for canonical decisions, user preferences, and high-leverage facts. Pinning everything defeats the purpose.",
        ].join(" "),
        inputSchema: {
          memory_id: z.string().min(1).describe("Id of the memory to pin or unpin."),
          pinned: z.boolean().default(true).describe("`true` (default) to pin, `false` to unpin."),
        },
        annotations: {
          title: "Pin or unpin a memory",
          readOnlyHint: false,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: false,
        },
        outputSchema: {
          message: z.string().describe("`Memory <id> pinned.` / `Memory <id> unpinned.` on success, `Memory <id> not found.` when missing."),
        },
      },
      async (params) => textResult(await handleMemoryPin(memRepo, params))
    );
  • Helper method on MemoriesRepo that delegates to update() to set the pinned field in the database.
    setPinned(id: string, pinned: boolean): boolean {
      return this.update(id, { pinned });
    }
Behavior5/5

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

Discloses key behavioral traits: idempotent (matches annotation), toggles pinned flag, and explains the consequence (memories survive pruning). No contradiction with annotations.

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?

Three concise sentences with no redundancy; every sentence adds value.

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?

Includes purpose, effect, usage guidelines, and idempotency. Given an output schema exists, return values are not required. Complete for a simple toggle tool.

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

Parameters3/5

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

Schema coverage is 100% and the description does not add significant meaning beyond what the schema provides. The mention of 'toggle' clarifies idempotency but is already implied by the idempotentHint annotation.

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 action ('Toggle the pinned flag') and the resource (memory), and explains the effect ('survive pruning and rank higher in search'), distinguishing it from sibling tools.

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?

Provides explicit guidance on when to use ('reserve pins for canonical decisions, user preferences, and high-leverage facts') and when not to ('Pinning everything defeats the purpose').

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/lfrmonteiro99/memento-mcp'

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