Manage the Reference Material attached to any document — add, remove, enable/disable and route dependents so your Charms see exactly what they need.
|
|
https://api.charmiq.ai/mcp/contextlist_context | |
add_context | |
update_context | |
remove_context |
charmiq:// URIs. Get them from the VFS server (list_dir, semantic_search, describe_file).charmiq:// URI attached to a document's context:charmiq://workspace/…, charmiq://charm/…, charmiq://chat/… | ||
charmiq://folder/… | ||
charmiq://file/… |
add_context derives it from the URI scope. Pass the URI; the server resolves the rest.enabled — whether the Charm uses the dependent at all. Newly added dependents are enabled by default. Disable a dependent to keep it attached but temporarily out of the Charm's context.readByModel — whether the model reads a rendered view of the dependent (only when its Model can render the type). The "the model reads it" path. Default on.sendToSandbox — whether the dependent's raw bytes go to the Charm's code-execution sandbox. The "the code runs against it" path (e.g. a CSV the Charm's code parses). Default off.readByModel and sendToSandbox are independent — a dependent can feed the model, the sandbox, both, or neither. update_context sets them per-dependent.remove_context detaches; it never deletes the document, asset or folder.list_context silently omits it.A Charm's own context is authoring context — it does not travel. A Charm is itself a document, so you can attach context to charmiq://charm/…— but that's the Reference Material for editing that Charm, symmetric to attaching context to a Workspace. When the Charm runs on a Workspace, only the Workspace's context applies. For per-run material, use the Workspace server'sreferenceMaterialargument instead.
update_context — pass dependentUri to update one dependent (any of enabled, readByModel, sendToSandbox). Omit dependentUri to apply enabled to every dependent at once. readByModel / sendToSandbox can only be set on a single dependent; trying to set them in bulk is an error.remove_context — pass dependentUris to remove specific dependents. Omit it to clear the entire context.charmiq:// URIs, not content. To discover, read or create the documents you attach, use the VFS server:list_dir / semantic_search / grep_search to find URIs to adddescribe_file to confirm what a URI points at before attaching itcreate_file to create a document, then add_context to attach itlist_context are live VFS URIs — hand them straight back to VFS tools to read or edit the dependent content.list_context to see the current dependents rather than caching them — the User can change context in the UI between your calls.add_context derive the dependent type from the URI scope. Don't try to classify documents yourself.enabled with update_context rather than removing and re-adding — it preserves the dependent's routing settings.sendToSandbox only for dependents the Charm's code actually parses; the default readByModel covers the "model reads it" case.add_context for material that stays loaded across runs. For a single run, prefer the Workspace server's referenceMaterial argument — merged onto the saved context for that one call, never persisted.# add_context — attach a dependent curl -X POST https://api.charmiq.ai/mcp/context \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "add_context", "arguments": { "uri": "charmiq://workspace/abc123", "dependentUris": ["charmiq://workspace/def456"] } } }'
list_context with { "uri": "charmiq://workspace/abc123" } — the response structuredContent.dependents array lists each attached dependent as a charmiq:// URI with its enabled, readByModel and sendToSandbox flags.