Skip to main content
Glama

Item Save

item_save

Save, update, or link durable project knowledge—rules, decisions, procedures, learnings, and secrets—in one transaction to keep context across sessions.

Instructions

Grava itens (criar, atualizar, upsert, renovar, relacionar) numa transação.

Use quando: Guardar o que vale para depois — uma regra que o usuário enunciou, as decisões e aprendizados ao fechar uma mudança, uma correção de um item. Retorna: [{index, id, key, action: created|updated|unchanged, similar?, relations?}]. Modo, por entrada: com key → upsert no domain (não duplica; o preferido); com id → atualiza o item; sem os dois → cria e devolve similar (títulos parecidos já guardados). Exemplo (upsert): item_save(project=".", items=[{"key": "regra/money", "type": "rule", "title": "Money em pagamentos", "summary": "Valores em Money, nunca double", "content": "...", "scope_paths": ["src/payments/**"], "source": "PAY-142"}]) Exemplo (aposentar): item_save(project=".", items=[{"key": "regra/x", "status": "deprecated"}]) Exemplo (substituir): item_save(project=".", items=[{"key": "proc/deploy-v2", ..., "relations": [{"type": "supersedes", "target": "proc/deploy"}]}]) Campos: type (rule, insight, procedure, pattern, knowledge, context, artifact, task), title, summary, content, keywords, source, scope_paths, status (active, done, superseded, deprecated), memory_class "ephemeral" + ttl_days só para nota temporária (sem aprovação: o resto já vale), tags, labels, relations [{type: related_to|depends_on|implements|references|supersedes|derived_from, target: id ou key}], workspace/domain (sem eles vale o domain ligado a project). Segredo: {"key": "segredo/npm-token", "type": "secret", "title": "Token do npm", "summary": "publicar no npm"} — sem valor (é recusado); a resposta traz fill_url: passe ao usuário para ele preencher na UI local. Usar: knowledge-mcp run --env NPM_TOKEN=segredo/npm-token -- <comando>. Notas: Um erro desfaz o lote e aponta a entrada. Conteúdo com cara de segredo é recusado.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsYes
projectNo
connection_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior5/5

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

With no annotations, the description carries the full behavioral burden and does so richly: batch is transactional (one error rolls back the lot and points at the offending entry), secret-like content is refused, secrets store no value and return a fill_url for the user to complete in the local UI, and similar-title detection fires on creation. This is exactly the operational context an agent needs before writing.

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?

It is long, but the bold labels (Use quando / Retorna / Modo / Exemplo / Campos / Segredo / Notas) front-load the mode decision and the examples each demonstrate a distinct operation rather than restating one. Dense yet every block earns its place for a tool with this many modes; slightly heavy for quick scanning.

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?

An output schema exists, yet the description still summarizes the return shape and, more importantly, covers the failure paths (rollback, refused secrets, rejected secret-like content) and the secret-filling workflow. Combined with the schema, an agent has everything needed to call this correctly on the first attempt.

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 coverage is 0%, so the description must compensate — and it largely does, documenting the per-item mode switch (key → upsert in domain, id → update, neither → create + similar), the full field list (type, status, relations, scope_paths, memory_class/ttl_days, workspace/domain), and the project/domain fallback. Only connection_id is left unexplained.

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 opening line states a specific verb and resource ("Grava itens") and enumerates the write modes it covers (criar, atualizar, upsert, renovar, relacionar) inside a transaction, so an agent immediately knows this is the write path. It never names the read/delete siblings (item_get, item_search, item_delete), but the semantics make the boundary obvious.

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?

"Use quando" gives concrete triggering situations — persisting a user-stated rule, decisions/learnings from a completed change, a correction to an item. It gives no explicit when-not or named alternative (e.g. use item_search to look things up, item_delete to remove), so the negative space is left to inference.

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