Skip to main content
Glama

kb_sources

Manage knowledge base source records and upload documents to stage pages and queue chunk/embed ingestion for retrieval.

Instructions

CRUD + inline upload for the KB registry (agent_data_sources). action: list | get | create (name, kind, ...; pgvector sources default to the shared ai_kb_embeddings/ai_kb_pages tables when config.table is omitted) | update (source_id + fields) | delete (source_id, confirm=true — detaches from every profile's data_source_ids, then hard-deletes) | upload_document (source_id, filename, content — stages a page row and queues background chunk/embed ingestion; pgvector sources only; refused with what to set when no embedding model is configured). list also returns embedding: the model in force.

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": {
      "action": "<action>"
    },
    "name": "kb_sources"
  }
}

Input Schema

NameRequiredDescriptionDefault
envNoConfig branch: which `environment` rows of the AI config DB to read/write. staging = the editable working set (default); prod = what production serves.staging
kindNoSource kind (pgvector, ...; see KB_KINDS).
nameNoKB source name.
titleNoupload_document: page title (default filename).
actionYesOperation to run: list | get | create | update | delete | upload_document. The tool description lists what each action needs.
configNoSource config JSON (pgvector: table, pages_table, chunking, embed_model).
confirmNofalse (default) = dry run, nothing changes; true = execute.
contentNoupload_document: the document text.
filenameNoFile name of the uploaded document.
languageNoLanguage code of the content.en
is_activeNoActive flag.
page_typeNoKB page type label, e.g. user_guide.user_guide
source_idNoagent_data_sources (KB source) UUID (kb_sources action=list).
agent_kindNoAgent kind the source belongs to.
refresh_cadenceNoHow often the source is refreshed (free text).
freshness_sla_hoursNoAlert when the source is older than this.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations to lean on, the description carries the full burden and does it well: delete is disclosed as detaching from every profile's data_source_ids before a hard delete, upload_document is disclosed as a staged page row with queued background chunk/embed ingestion, `list` returns the in-force embedding model, and the pgvector default-table fallback is explained. It also names the failure mode (refused with guidance when no embedding model is set), which the agent cannot infer from the schema.

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?

Front-loads the resource and the action enumeration, then attaches behavior notes to the actions that need them. The parenthetical-per-action format is dense but every clause carries either a required argument or a side effect; readability suffers slightly from cramming everything into one paragraph.

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?

For a 16-parameter action-dispatch tool with an output schema, the description covers what the agent must know to call it correctly: action routing, destructive delete semantics, async ingestion, and the pgvector-only constraint. Minor gaps remain around `get` (implied to use source_id but not stated) and any listing/limit behavior for `list`.

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 description coverage is 100%, so a 3 is the baseline; the description adds routing meaning on top by mapping which parameters each action consumes. It also clarifies that pgvector sources default to ai_kb_embeddings/ai_kb_pages when config.table is omitted, which the schema's config description does not state.

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?

Opens with a specific verb family and resource: "CRUD + inline upload for the KB registry (agent_data_sources)", then enumerates all six actions by name. An agent immediately knows this is the CRUD surface for KB sources, which is distinct from the profile/agent/analytics siblings.

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?

Gives per-action selection guidance via required arguments (create needs name/kind; update needs source_id + fields; delete needs source_id + confirm=true; upload needs source_id/filename/content) and states an explicit exclusion: upload_document is "pgvector sources only" and is refused when no embedding model is configured. It does not discuss when another tool would be a better choice, which keeps it below a 5.

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