Implementation:0xranx OpenContext Store setDocDescription
| Knowledge Sources | |
|---|---|
| Domains | Knowledge_Management, API |
| Last Updated | 2026-10-24 12:00 GMT |
Overview
Concrete tool for updating document descriptions in the OpenContext knowledge base, keeping manifest and triage metadata fresh.
Description
The setDocDescription function updates the description field of a document in the SQLite database. The description is used in manifest generation and search result display, making it essential for discoverability and triage.
This function only updates the database metadata — it does not modify the document's content file. The description should be kept in sync with the document's current state, especially after content edits.
Usage
- Document Lifecycle: Update descriptions after content changes to keep manifests useful.
- Agent iteration: After enriching a document, agents should call `oc doc set-desc` to reflect the latest summary.
- MCP integration: The `oc_set_doc_desc` MCP tool wraps this function.
Code Reference
Source Location
- Repository: OpenContext
- File (JS adapter): src/core/store-native.js
- File (Rust core): crates/opencontext-core/src/lib.rs
- File (CLI): bin/oc.js
- File (MCP): src/mcp/server.js
Signature
/**
* Set document description
* @param {{ docPath: string, description: string }} options
* @returns {{ rel_path: string, description: string }}
*/
function setDocDescription(options) {
return handleResult(native.get().setDocDescription({
docPath: options.docPath,
description: options.description,
}));
}
Import
const { setDocDescription } = require('./core/store-native');
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| options.docPath | string | Yes | Document path relative to contexts/ |
| options.description | string | Yes | New description text |
Outputs
| Name | Type | Description |
|---|---|---|
| returns.rel_path | string | Document relative path |
| returns.description | string | Updated description |
Usage Examples
Update Description (CLI)
oc doc set-desc projects/architecture/design.md "Updated: Q1 architecture decisions"
Update Description (JavaScript)
const { setDocDescription } = require('./core/store-native');
const result = setDocDescription({
docPath: 'projects/architecture/design.md',
description: 'Updated: Q1 architecture decisions'
});
console.log(`Updated: ${result.rel_path}`);