Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

You are connected to kb, a local Agent memory & knowledge service. kb is a resident local service whose MCP tools you can call right now to write/retrieve memories and knowledge. It is normally running; no health check or pre-probing is required — just call the tools directly and keep working when things are normal.

[Identity & projects]

  • The client is auto-detected; never self-report or display it.

  • project separates memories between projects: when the user is clearly working in a project context (project name, repository name, or project directory), pass that project's stable short name as project; always use the same name for the same project.

  • Project memories are visible only under that project. Without project, writes go to global memory (visible to every project) — suitable for user preferences, general facts, and cross-project conventions. Never guess a project name: write globally or ask the user.

  • Searching with project covers that project plus global memory; without it, only global memory.

[Memory language]

  • Always write memories in English; keep proper nouns, code, commands, and paths unchanged — do not translate them.

[When to write memory (write_memory, 1-3 concise sentences)]

  1. User preferences: themes, toolchain, code style, naming habits, communication style.

  2. Project decisions: settled tech choices, architecture trade-offs, conventions — with context and conclusion.

  3. Facts & conventions: key paths, commands, dependencies, environment details, version constraints.

  4. Sensitive constraints: explicit hard rules ("do not"), security/privacy requirements.

  5. Task progress: key progress of complex tasks and next steps, for cross-session handoff. Do NOT write: chit-chat, transient computation, implementation details directly findable in code/docs.

  • Dedupe before writing: search_memory first; if similar content exists, update_memory to overwrite instead of adding duplicates.

  • Never store sensitive data: keys, credentials, ID numbers are forbidden.

[When to search (search_memory)]

  • Proactively recall at task start, when an answer involves past decisions/preferences, or on cross-session handoff; ask in natural language describing the semantics.

  • When two memories have a clear relationship (same topic, supersession, dependency, part-of, contradiction), link them with link_memory; keep links few and precise rather than connecting everything. list_links shows one-hop neighbors, and searches automatically surface linked memories (the via field marks the source).

[Feedback to user (important — keep it minimal)]

  • On successful write/update: mention it briefly, e.g. "Noted your preference."

  • On failure, state the reason (e.g. "Not saved: duplicate of an existing memory / sensitive content / unsupported format").

  • Do NOT show: health-check process, tool names, record IDs, JSON, retrieval hit details.

  • Only if an MCP tool call fails with a connection error (service truly unreachable), briefly say "kb service is not running; start it with python -m kb serve". Never fabricate results.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}

Tools

Functions exposed to the LLM to take actions

NameDescription
write_memoryA

写入一条记忆短文本(事实/笔记/摘要),可选标签;返回 {"id": 记录ID}。 内容为空串或纯空白时返回 {"error": "INVALID_ARGUMENT", "message": 原因}。 project 指定项目子库(空=全局库);client 仅用于审计归类(自动识别); 记录主键由服务端生成。 English: Write a memory short text (fact/note/summary) with optional tags; returns {"id": record_id}. Returns {"error": "INVALID_ARGUMENT", "message": reason} when content is empty or blank. project selects the project sub-store (empty = global); client is audit-bucketing only (auto-detected). The record primary key is generated server-side.

search_memoryA

混合检索记忆与知识(向量语义 + BM25 关键词,归一化融合); 返回命中列表,每项含 id/content/score/type/source。 project 指定项目子库时,检索范围 = 该项目子库 + 全局库(项目命中加分); 不传 project 时只检索全局库。 table=true 时先尝试确定性表格问答:命中返回 {"table": true, "answer", "sources"}, 未命中回退普通检索;整个过程不需要 LLM。 top_k 小于 1 时返回 {"error": "INVALID_ARGUMENT", "message": 原因}。 client:来源客户端(可选,缺省从 clientInfo 自动识别,仅审计)。 English: Hybrid retrieval over memories and knowledge (vector semantics + BM25 keywords, normalized fusion); returns a hit list, each item having id/content/score/type/source. With project, the scope is that project's sub-store plus the global store (project hits boosted); without project, only the global store is searched. With table=true, try deterministic table Q&A first and return {"table": true, "answer", "sources"} on a hit; otherwise fall back to normal retrieval. No LLM is involved. Returns {"error": "INVALID_ARGUMENT", "message": reason} when top_k is less than 1. client: source client (optional; auto-detected from clientInfo when omitted; audit only).

read_memoryA

按 ID 读取单条记忆完整内容;记录不存在返回 {"error": "NOT_FOUND"}。 project:先查该项目子库,再查全局库;不传时先查全局库再查各项目子库。 client:来源客户端(可选,缺省从 clientInfo 自动识别,仅审计)。 English: Read the full content of a single memory by ID; returns {"error": "NOT_FOUND"} when absent. project: search that project's sub-store first, then the global store; when omitted, global first and then each project store. client is audit-only.

update_memoryA

按 ID 更新记忆内容(变更后自动重新嵌入);记录不存在返回 {"error": "NOT_FOUND"}; 内容为空串或纯空白时返回 {"error": "INVALID_ARGUMENT", "message": 原因}。 project:先查该项目子库,再查全局库;不传时先查全局库再查各项目子库。 client:来源客户端(可选,缺省从 clientInfo 自动识别,仅审计)。 English: Update a memory's content by ID (auto re-embed on change); returns {"error": "NOT_FOUND"} when absent; empty content returns {"error": "INVALID_ARGUMENT", "message": reason}. project: locate in that project's sub-store, then the global store; when omitted, global first and then each project store. client is audit-only.

delete_memoryA

按 ID 删除一条记忆;成功返回 {"ok": true},记录不存在返回 {"error": "NOT_FOUND"}。 project:先查该项目子库,再查全局库;不传时先查全局库再查各项目子库。 client:来源客户端(可选,缺省从 clientInfo 自动识别,仅审计)。 English: Delete a memory by ID; returns {"ok": true} on success and {"error": "NOT_FOUND"} when it does not exist. project: locate in that project's sub-store then the global store; when omitted, global first and then each project store. client is audit-only.

link_memoryA

建立两条记忆的关联(related/supersedes/depends_on/part_of/contradicts); 重复建边幂等(created=false)。仅同作用域的 memory 记录可关联,禁止自关联; 失败返回 {"error": , "message": 原因}(NOT_FOUND/SELF_LINK/...)。 project:项目子库(空=全局库);client:仅审计。 English: Link two memories (related/supersedes/depends_on/part_of/contradicts); duplicate edges are idempotent (created=false). Only memory records in the same scope can be linked, and self-links are rejected; failures return {"error": , "message": reason}.

unlink_memoryB

取消两条记忆的关联(任一方向);relation 为空时删除该对全部关系。 返回 {"ok": true, "removed": 删除数};记录不存在返回 {"error": "NOT_FOUND"}。 English: Remove links between two memories in either direction; when relation is empty all relations of the pair are removed. Returns {"ok": true, "removed": n}.

list_linksB

列某条记忆的一跳邻居,返回 {"record_id", "links"};每项含 id/content/type/tags/relation/direction(out/in/both)。 记录不存在返回 {"error": "NOT_FOUND"}。 English: List one-hop neighbors of a memory as {"record_id", "links"}; each item has id/content/type/tags/relation/direction (out/in/both).

add_documentB

导入本地文档(PDF/DOCX/MD/TXT 及 Office 格式)切分入库; 返回 {"source": 文件名, "chunks": 块数};文件不存在或格式不支持时 返回 {"error": "FILE_NOT_FOUND" | "UNSUPPORTED_FORMAT", "message": 原因}。 project:文档 chunk 落入该项目子库(空=全局库);client:仅用于审计归类。 English: Import a local document (PDF/DOCX/MD/TXT and Office formats), split and ingest it; returns {"source": filename, "chunks": count}; when the file is missing or the format is unsupported returns {"error": "FILE_NOT_FOUND" | "UNSUPPORTED_FORMAT", "message": reason}. project: chunks go to that project's sub-store (empty = global); client is audit-only.

add_webpageA

抓取网页正文并切分入库;返回 {"source": url, "chunks": 块数}; 抓取/正文提取失败时返回 {"error": "WEB_FETCH_FAILED", "message": 原因}。 project:web chunk 落入该项目子库(空=全局库);client:仅用于审计归类。 English: Fetch a webpage body and ingest it after splitting; returns {"source": url, "chunks": count}; on fetch/body-extraction failure returns {"error": "WEB_FETCH_FAILED", "message": reason}. project: chunks go to that project's sub-store (empty = global); client is audit-only.

list_documentsA

列出已入库的 RAG 内容(按 source 聚合,kind=doc/web/table), project 指定项目子库(空=全局库);client 仅用于审计归类。 返回 [{"source", "chunks", "chars", "last_imported", "kind"}]。 English: List ingested RAG content grouped by source (kind=doc/web/table); project selects the sub-store (empty = global); client is audit-only. Returns [{"source", "chunks", "chars", "last_imported", "kind"}].

delete_documentA

按 source 删除一份 RAG 文档/网页/表格的全部记录,返回 {"source", "deleted"}; 删除会级联清理 BM25 与向量索引;source 为空时返回 INVALID_ARGUMENT。 project 指定项目子库(空=全局库);client 仅用于审计归类。 English: Delete all records of one RAG document/webpage/table by source, returning {"source", "deleted"}; cascades to BM25 and vector indexes; empty source returns INVALID_ARGUMENT. project selects the sub-store (empty = global); client is audit-only.

ask_kbA

基于知识库的 RAG 问答(检索 → 上下文拼装 → 护栏生成),返回 answer 与 sources; project:检索该项目子库 + 全局库(空=仅全局库),并写 ask 存取审计; client:来源客户端(可选,缺省从 clientInfo 自动识别,仅审计); LLM 不可用时返回 {"error": "LLM_DISABLED", "message": 配置指引}。 English: Knowledge-base RAG Q&A (retrieve → build context → guarded generation), returning answer and sources; project: search that project's sub-store plus the global store (empty = global only); an ask access-audit is emitted; client is audit-only; returns {"error": "LLM_DISABLED", "message": setup guidance} when the LLM is unavailable.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A3.8/5.0

Scored across 13 tools

Disambiguation4/5

Memory CRUD (write/read/update/delete), link management (link/unlink/list_links), document ingestion (add_document/add_webpage/delete_document/list_documents), and Q&A (ask_kb) are largely distinct. The one real overlap is search_memory's table=true deterministic Q&A mode, which produces answers similarly to ask_kb and could confuse an agent choosing between them.

Naming Consistency5/5

All tools follow a consistent snake_case verb_noun pattern (read_memory, write_memory, add_document, delete_document, list_links, search_memory), with ask_kb being the only slight variant but still verb_object. No mixing of camelCase or vague single verbs.

Tool Count5/5

13 tools is well within the ideal 3-15 range and each maps to a concrete operation across three coherent sub-areas (memory, documents, Q&A). No filler tools or redundant duplicates.

Completeness4/5

Memory lifecycle is fully covered (write/read/update/delete/search/links) and document ingestion has add/list/delete plus web import. Minor gaps: no way to enumerate or browse all memories/tags without a query, and no document update/re-index or move operation, but these are workable around via search and re-ingest.

Maintenance

ActivityNo data
ResponsivenessOutdated data