Skip to main content
Glama

get_user_context

Read-onlyIdempotent

Retrieve tiered cold-start user context at conversation start to inject identity, preferences, quality standards, and lessons. Choose quick, standard, or full levels with optional token budget.

Instructions

获取用户的个性化上下文(冷启动,分层延迟可控)。 / Get tiered cold-start user context with latency control.

**Lifecycle: startup** — 对话开始时调用,为 AI 注入用户身份和上下文。
Lifecycle: startup — call at conversation start to inject user identity and context.

用途:在每次新对话开始时调用,了解用户是谁、如何工作、学到了什么、质量标准是什么。
Purpose: Call at the start of each new conversation to understand who the user is, how they work, what they have learned, and their quality bar.

分层说明 / Tiered behaviour:
- "quick": 仅身份画像 + 工作偏好(纯 JSON 读取,无文件扫描,最低延迟)。
  Profile + preferences only — pure JSON reads, no filesystem scans. Lowest latency.
- "standard"(默认): 加上质量标准、经验领域、相关教训/决策、项目快照。
  Default. Adds quality, domains, top lessons/decisions, project snapshot.
- "full": 完整上下文,含冲突检测、过期/暂存提醒。仅在用户明确要求"全量回顾"时使用。
  Full context including conflict detection and stale/staging warnings. Use only when the user explicitly asks for a comprehensive memory review.

任何级别都只读:不扫描、不导入其它 AI 工具的文件(那是用户在终端运行的 `engram import-memories`)。
Every level only reads: other AI tools' files are never scanned or imported here (that is the user's `engram import-memories` command in a terminal).

注意:默认 "standard" 已覆盖绝大多数冷启动需求;只有用户问"我们之前所有决定/经验"或要做记忆健康检查时才用 "full"。
Note: "standard" covers most cold-start needs. Use "full" only when the user asks for a comprehensive memory review.

Args:
    project_folder: 当前项目文件夹路径(可选)。 / Current project folder path (optional).
    level: "quick" | "standard" | "full",默认 "standard"。 / Tier — defaults to "standard".
    token_budget: 上下文 token 预算(可选)。设定后按优先级裁剪 section,低优先级 section 先丢弃,末尾一行注明省略了什么。不设则返回全量。
        Optional token budget. When set, sections are included by priority until budget is exhausted;
        a cut ends the context with one line naming what was left out.
    user_prompt: 用户当前提问(可选)。传入后会追加到上下文末尾,并与已存 Playbook 的
        triggers 关键词匹配,命中时浮现「相关 Playbook」小节(标题 + ID;用 get_playbooks(mode="get") 查看完整步骤)。
        Optional current user prompt. Appended to the context and matched against stored
        playbook trigger keywords; hits surface a "Matched Playbooks" section (title + id;
        call get_playbooks(mode="get") for the full steps).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "get_user_context"
  }
}

Input Schema

NameRequiredDescriptionDefault
levelNostandard
user_promptNo
token_budgetNo
project_folderNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv4.6.2
  2. Removedv4.6.1
  3. Addedv3.29.1

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already cover read-only, idempotent and closed-world, but the description goes further: it discloses that no level touches the filesystem or other tools' files, that token_budget drops low-priority sections and appends a line naming what was omitted, and that user_prompt triggers playbook keyword matching. These are behavioral traits an agent could not infer from the structured fields.

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?

Well front-loaded with the lifecycle trigger, then tiers, then cautions, then args; every block is scannable. The only waste is the line-by-line Chinese/English duplication, which roughly doubles the token cost without adding information for a single-language reader.

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?

For a zero-required-parameter read tool with an output schema, nothing an agent needs is missing: trigger, tier contents, default, truncation behavior, and the downstream call for full playbook steps are all stated. The output schema can handle return-shape detail.

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

Parameters5/5

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

Schema description coverage is 0% and the level enum is absent from the schema, so the description carries the full burden — and it does: all four parameters are explained, including the three concrete 'level' values with what each contains, the priority-based truncation semantics of token_budget, and the playbook-matching side effect of user_prompt.

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?

States a concrete verb and resource ('Get tiered cold-start user context with latency control') plus a plain-language purpose ('understand who the user is, how they work, what they have learned, and their quality bar'). The tier breakdown makes the scope of this tool distinguishable from narrower siblings like get_identity_card or get_project_context.

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?

Gives an explicit trigger ('call at the start of each new conversation'), an explicit default ('standard' covers most cold-start needs), and an explicit exclusion for 'full' ('use only when the user asks for a comprehensive memory review'). It also pre-empts a likely mistake by noting that importing other AI tools' files is not done here but via the terminal command.

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