Skip to main content
Glama

get_context

Read-only

Retrieve the messages before and after a search result to clarify what a question answered, how a reply fits, or what a pronoun refers to.

Instructions

The messages around one message, in its chat, oldest first; it has hit: true.

Use it when a search result is relevant but needs what was said around it: the question it answers, the reply, what "it" refers to.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "memory_id": "<memory_id>"
    },
    "name": "get_context"
  }
}

Input Schema

NameRequiredDescriptionDefault
afterNoMessages after it. Default 5.
beforeNoMessages before it. Default 5.
memory_idYesThe id of a search result, exactly as given

Output Schema

NameRequiredDescriptionDefault
messagesYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.5.1
    • changedOutput schema / $defs / Message / properties / deleted / description
      Previous value: -"Deleted for everyone after it was read"New value: +"Deleted or unsent in its app after memoreei kept it; mark says when"
    • addedOutput schema / $defs / Message / properties / mark
      Added value: +{
      +  "description": "What its app did to it since, e.g. 'deleted in Signal on 2026-11-09' or 'expired in Signal'. memoreei kept it; say so if it matters",
      +  "title": "Mark",
      +  "type": "string"
      +}
    • addedOutput schema / $defs / Message / properties / via
      Added value: +{
      +  "description": "The other memoreei (a computer of the owner's) this copy came from",
      +  "title": "Via",
      +  "type": "string"
      +}
  2. Changed12 schema fields changedv0.4.7
    • addedInput schema / properties / after / description
      Added value: +"Messages after it. Default 5."
    • addedInput schema / properties / after / maximum
      Added value: +50
    • addedInput schema / properties / after / minimum
      Added value: +0
    • addedInput schema / properties / before / description
      Added value: +"Messages before it. Default 5."
    • addedInput schema / properties / before / maximum
      Added value: +50
    • addedInput schema / properties / before / minimum
      Added value: +0
    • addedInput schema / properties / memory_id / description
      Added value: +"The id of a search result, exactly as given"
    • addedOutput schema / $defs
      Added value: +{
      +  "Message": {
      +    "properties": {
      +      "chat": {
      +        "description": "The group's name, or the other person in a one-to-one chat",
      +        "title": "Chat",
      +        "type": "string"
      +      },
      +      "content": {
      +        "description": "The message, as stored: usually 'sender: text'",
      +        "title": "Content",
      +        "type": "string"
      +      },
      +      "date": {
      +        "description": "When it was sent, YYYY-MM-DD HH:MM, owner's time zone",
      +        "title": "Date",
      +        "type": "string"
      +      },
      +      "deleted": {
      +        "description": "Deleted for everyone after it was read",
      +        "title": "Deleted",
      +        "type": "boolean"
      +      },
      +      "group": {
      +        "description": "True for a group chat",
      +        "title": "Group",
      +        "type": "boolean"
      +      },
      +      "hit": {
      +        "description": "The message get_context was asked about",
      +        "title": "Hit",
      +        "type": "boolean"
      +      },
      +      "id": {
      +        "description": "Pass to get_context to read around this message",
      +        "title": "Id",
      +        "type": "string"
      +      },
      +      "platform": {
      +        "description": "imessage, whatsapp, signal, …",
      +        "title": "Platform",
      +        "type": "string"
      +      },
      +      "sender": {
      +        "description": "Who wrote it; 'me' is the owner",
      +        "title": "Sender",
      +        "type": "string"
      +      },
      +      "source": {
      +        "description": "The chat's id, for the source filter",
      +        "title": "Source",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "id",
      +      "date",
      +      "platform",
      +      "chat",
      +      "group",
      +      "sender",
      +      "content",
      +      "source"
      +    ],
      +    "title": "Message",
      +    "type": "object"
      +  }
      +}
    • addedOutput schema / properties / messages
      Added value: +{
      +  "items": {
      +    "$ref": "#/$defs/Message"
      +  },
      +  "title": "Messages",
      +  "type": "array"
      +}
    • removedOutput schema / properties / result
      Removed value: -{
      -  "items": {
      -    "additionalProperties": true,
      -    "type": "object"
      -  },
      -  "title": "Result",
      -  "type": "array"
      -}
    • changedOutput schema / required
      Previous value: -[
      -  "result"
      -]New value: +[
      +  "messages"
      +]
    • changedOutput schema / title
      Previous value: -"get_contextOutput"New value: +"Context"
  3. First observedv0.2.2

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, and the description usefully adds ordering semantics (oldest first) and the fact that context is confined to the same chat. It says nothing about behavior at chat boundaries, whether the window is truncated, or what 'hit: true' means beyond a cryptic fragment.

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?

Two short paragraphs with the scope statement first and the usage guidance second; very little waste. The closing 'it has hit: true' clause is unexplained and slightly undermines an otherwise tight, front-loaded definition.

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?

With an output schema present, return values need not be described, and the annotations cover the safety profile. What remains thin is failure behavior for an unknown or deleted memory_id and boundary handling at the start or end of a chat, minor gaps for a simple read 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%, so before/after counts, defaults, and the memory_id format are already fully documented in the schema. The description adds no additional syntax or constraint detail, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a concrete resource and scope: the messages surrounding one message, within its chat, ordered oldest first. That is more specific than the title alone and implicitly contrasts with a plain search, though it never names the search tool it complements and the trailing 'it has hit: true' fragment is ambiguous.

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?

It gives a clear trigger condition: use it when a search result is relevant but needs surrounding dialogue to resolve pronouns, questions, and replies. This is genuine when-to-use guidance, but there is no explicit when-not-to-use case or named alternative for fetching full-chat history instead of a window.

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