Skip to content

MCP Tools Reference

Cortex exposes memory primitives as MCP tools. Any MCP-compatible client can discover and use these tools through the standard protocol.

MCP clients discover available tools during the handshake. Cortex returns tool schemas that describe parameters, types, and expected responses.

Example tool listing (truncated):

{
"tools": [
{
"name": "knowledge_search",
"description": "Search the knowledge store with hybrid vector + full-text matching",
"inputSchema": {
"type": "object",
"properties": {
"query": { "type": "string", "description": "Search query" },
"collection": { "type": "string", "description": "Optional collection filter" },
"mode": { "type": "string", "enum": ["vector", "fts", "hybrid"] },
"limit": { "type": "integer", "default": 10 }
},
"required": ["query"]
}
}
]
}

Add a message to a conversation thread.

Parameters:

NameTypeRequiredDescription
thread_idstringYesUnique thread identifier
rolestringYesMessage role: user, assistant, system, tool
contentstringYesMessage content
metadataobjectNoAdditional metadata (tool calls, citations, etc.)

Response:

{
"message_id": "msg_abc123",
"thread_id": "support-ticket-456",
"created_at": "2024-01-15T10:30:00Z"
}

Example:

{
"tool": "conversation_append",
"arguments": {
"thread_id": "support-ticket-456",
"role": "user",
"content": "I can't access my account"
}
}

Retrieve conversation history for a thread.

Parameters:

NameTypeRequiredDescription
thread_idstringYesThread identifier
limitintegerNoMaximum messages (default: 50)
beforestringNoISO timestamp, return messages before this
afterstringNoISO timestamp, return messages after this

Response:

{
"thread_id": "support-ticket-456",
"messages": [
{
"id": "msg_001",
"role": "user",
"content": "I can't access my account",
"created_at": "2024-01-15T10:30:00Z"
},
{
"id": "msg_002",
"role": "assistant",
"content": "I'd be happy to help. Can you provide your email?",
"created_at": "2024-01-15T10:30:15Z"
}
],
"has_more": false
}

Semantic search across conversation messages.

Parameters:

NameTypeRequiredDescription
querystringYesSearch query
thread_idstringNoLimit to specific thread
namespacestringNoNamespace filter
limitintegerNoMaximum results (default: 10)

Response:

{
"results": [
{
"message_id": "msg_789",
"thread_id": "support-ticket-456",
"role": "user",
"content": "I can't access my account after password reset",
"score": 0.89,
"created_at": "2024-01-15T10:30:00Z"
}
]
}

Summarize and compress conversation history.

Parameters:

NameTypeRequiredDescription
thread_idstringYesThread to summarize
keep_recentintegerNoNumber of recent messages to keep uncompressed

Response:

{
"thread_id": "support-ticket-456",
"summary": "User reported account access issues after password reset. Agent verified identity and initiated manual unlock.",
"original_count": 45,
"compressed_count": 12
}

Ingest a document into the knowledge store.

Parameters:

NameTypeRequiredDescription
collectionstringYesTarget collection
titlestringYesDocument title
contentstringYesDocument content
source_urlstringNoOriginal source URL
metadataobjectNoAdditional metadata
chunk_strategystringNofixed, sentence, paragraph, semantic
chunk_max_tokensintegerNoMaximum tokens per chunk
chunk_overlapintegerNoToken overlap between chunks

Response:

{
"document_id": "doc_abc123",
"collection": "docs",
"chunks_created": 12,
"total_tokens": 3500
}

Batch ingest multiple documents.

Parameters:

NameTypeRequiredDescription
collectionstringYesTarget collection
documentsarrayYesArray of document objects

Each document in the array:

NameTypeRequiredDescription
titlestringYesDocument title
contentstringYesDocument content
source_urlstringNoOriginal source URL
metadataobjectNoAdditional metadata

Response:

{
"collection": "docs",
"documents_ingested": 15,
"total_chunks": 180,
"errors": []
}

Search the knowledge store with hybrid matching.

Parameters:

NameTypeRequiredDescription
querystringYesSearch query
collectionstringNoLimit to collection
modestringNovector, fts, or hybrid (default)
limitintegerNoMaximum results (default: 10)
thresholdnumberNoMinimum similarity score
metadata_filterobjectNoFilter by metadata fields

Response:

{
"results": [
{
"chunk_id": "chunk_456",
"document_id": "doc_abc123",
"title": "Authentication Guide",
"content": "To configure OAuth, first create an application...",
"score": 0.92,
"metadata": {
"category": "authentication"
}
}
],
"search_mode": "hybrid"
}

Manage collections.

Parameters:

NameTypeRequiredDescription
actionstringYeslist, create, delete, stats
namestringConditionalRequired for create, delete, stats
descriptionstringNoFor create action

Response (list):

{
"collections": [
{
"name": "docs",
"description": "Product documentation",
"document_count": 45,
"chunk_count": 890
}
]
}

Retrieve a value by key.

Parameters:

NameTypeRequiredDescription
keystringYesKey to retrieve
run_idstringNoScope to specific run

Response:

{
"key": "config/debug",
"value": {"enabled": true, "level": "verbose"},
"version": 3,
"expires_at": null,
"updated_at": "2024-01-15T10:30:00Z"
}

Store a value.

Parameters:

NameTypeRequiredDescription
keystringYesKey to set
valueanyYesValue to store (JSON)
ttl_secondsintegerNoTime-to-live in seconds
run_idstringNoScope to specific run

Response:

{
"key": "config/debug",
"version": 4,
"expires_at": "2024-01-16T10:30:00Z"
}

Merge a value with existing data.

Parameters:

NameTypeRequiredDescription
keystringYesKey to merge
valueobjectYesValue to merge
strategystringNoreplace, merge_shallow, merge_deep, append

Response:

{
"key": "config/settings",
"version": 5,
"merged_keys": ["new_key", "updated_key"]
}

List keys with optional prefix filter.

Parameters:

NameTypeRequiredDescription
prefixstringNoKey prefix filter
run_idstringNoScope to specific run
limitintegerNoMaximum results

Response:

{
"keys": [
{
"key": "config/debug",
"version": 4,
"has_ttl": false
},
{
"key": "config/settings",
"version": 5,
"has_ttl": true
}
]
}

View version history for a key.

Parameters:

NameTypeRequiredDescription
keystringYesKey to inspect
limitintegerNoMaximum versions

Response:

{
"key": "config/debug",
"versions": [
{
"version": 4,
"value": {"enabled": true},
"updated_at": "2024-01-15T10:30:00Z"
},
{
"version": 3,
"value": {"enabled": false},
"updated_at": "2024-01-14T08:00:00Z"
}
]
}

Look up an entity by name or alias.

Parameters:

NameTypeRequiredDescription
namestringYesEntity name or alias
typestringNoFilter by entity type

Response:

{
"entity": {
"id": "ent_123",
"name": "Acme Corporation",
"type": "organization",
"aliases": ["Acme", "Acme Corp"],
"description": "Technology company founded in 2010",
"mention_count": 45,
"metadata": {}
}
}

Semantic search across entities.

Parameters:

NameTypeRequiredDescription
querystringYesSearch query
typestringNoFilter by entity type
limitintegerNoMaximum results

Response:

{
"results": [
{
"id": "ent_456",
"name": "Jane Smith",
"type": "person",
"score": 0.87,
"description": "Software engineer at Acme"
}
]
}

Get relationships for an entity.

Parameters:

NameTypeRequiredDescription
entity_idstringYesEntity ID
directionstringNoincoming, outgoing, both (default)
typestringNoFilter by relationship type

Response:

{
"entity_id": "ent_456",
"relationships": [
{
"id": "rel_001",
"type": "works_at",
"direction": "outgoing",
"target": {
"id": "ent_123",
"name": "Acme Corporation",
"type": "organization"
}
}
]
}

Modify entity attributes.

Parameters:

NameTypeRequiredDescription
entity_idstringYesEntity ID
namestringNoUpdated name
descriptionstringNoUpdated description
metadataobjectNoMetadata to merge

Response:

{
"entity_id": "ent_456",
"updated_fields": ["description", "metadata"]
}

Combine duplicate entities.

Parameters:

NameTypeRequiredDescription
keep_idstringYesEntity to keep
remove_idstringYesEntity to merge and remove

Response:

{
"kept_entity_id": "ent_123",
"removed_entity_id": "ent_789",
"aliases_merged": 3,
"relationships_transferred": 5
}

List entities with filters.

Parameters:

NameTypeRequiredDescription
typestringNoFilter by entity type
sortstringNoSort by: name, mention_count, created_at
limitintegerNoMaximum results
offsetintegerNoPagination offset

Response:

{
"entities": [
{
"id": "ent_123",
"name": "Acme Corporation",
"type": "organization",
"mention_count": 45
}
],
"total": 150,
"has_more": true
}

All tools return errors in a consistent format:

{
"error": {
"code": "not_found",
"message": "Entity with ID 'ent_999' not found",
"details": {}
}
}

Common Error Codes:

CodeDescription
not_foundResource does not exist
invalid_inputInvalid parameter value
namespace_errorNamespace access denied
storage_errorDatabase operation failed
embedding_errorEmbedding generation failed