MCP server

MCP tools reference

Complete reference for all seven Spectron MCP tools.

Spectron exposes seven tools over the Model Context Protocol at /mcp. All tools use the same API-KEY authentication as the REST API and respect the X-Spectron-Context and X-Spectron-Scope headers set during installation.

Every tool response includes:

FieldTypeDescription
trace_idstringCorrelates this call with trace records in the substrate (decision_trace, retrieval_trace, or response_trace depending on the tool). Use for debugging and audit walks.

Every tool that writes experiential memory also returns:

FieldTypeDescription
turn_idstringThe turn record created by the extraction pipeline

Store a conversational exchange. Spectron auto-classifies the content, reconciles new facts against existing memory, and persists structured records to the experiential graph.

REST equivalent: POST /api/v1/{context_id}/facts

FieldTypeRequiredDescription
role"user" \| "assistant"YesWho produced the content
contentstringYesThe message text to extract memory from
session_idstringNoExisting session to append to. A new session is created if omitted.
scopeobjectNoScope key–value pairs. Overrides the default scope from X-Spectron-Scope.
FieldTypeDescription
turn_idstringID of the turn record created
session_idstringSession the turn was appended to
entitiesarrayEntities extracted from the content
attributesarrayAttributes extracted and persisted
relationsarrayRelations between entities
instructionsarrayImperative instructions extracted (e.g. "always respond in bullet points")
uncertaintiesarrayUncertain or unverifiable claims flagged during extraction
correctionsarrayValues that supersede previously stored attributes
trace_idstringTrace record ID

An LLM invokes this tool at the end of a conversation turn:

Tool: memory_store
Input: {
"role": "user",
"content": "I just got promoted to VP of Engineering and I'm moving to Singapore next month.",
"scope": { "user": "alice", "org": "acme" }
}

Output: {
"turn_id": "turn:01jt4kx...",
"session_id": "session:01jt4ky...",
"entities": [
{ "id": "Person/alice", "label": "Alice" }
],
"attributes": [
{ "entity": "Person/alice", "key": "role", "value": "VP of Engineering", "category": "identity" },
{ "entity": "Person/alice", "key": "city", "value": "Singapore", "category": "identity", "valid_from": "2026-06-01" }
],
"relations": [],
"instructions": [],
"corrections": [],
"trace_id": "trace:01jt4m..."
}

Retrieve relevant context for a query from experiential memory and authoritative knowledge in one call. Returns a pre-formatted context string designed for direct injection into an LLM system prompt.

REST equivalent: POST /api/v1/{context_id}/context

FieldTypeRequiredDescription
querystringYesNatural-language query describing what context to retrieve
kintegerNoMaximum number of memory hits to include (default: 10)
scopeobjectNoScope filter. Overrides the default scope.
FieldTypeDescription
contextstringFormatted context block for system prompt injection
tierstringResolution tier used: "direct", "cache", "hybrid", or "full_context"
query_msintegerTime taken to resolve the query in milliseconds
trace_idstringTrace record ID
Tool: memory_recall
Input: {
"query": "What do I know about Alice's current situation?",
"scope": { "user": "alice", "org": "acme" }
}

Output: {
"context": "### Alice\n- Role: VP of Engineering (updated 2026-05-12)\n- City: Singapore (from 2026-06-01)\n- Organisation: Acme Corp\n- Preference: Concise answers, no filler phrases",
"tier": "direct",
"query_ms": 3,
"trace_id": "trace:01jt4n..."
}

The context string can be placed directly in a system prompt:

You are a helpful assistant.

## Memory
### Alice
- Role: VP of Engineering (updated 2026-05-12)
...

Synthesise patterns and insights from existing memories. Useful for periodic summarisation, generating user briefs, or deriving higher-order facts from accumulated context.

Pass persist: true to write the derived attributes back to experiential memory as durable facts.

REST equivalent: POST /api/v1/{context_id}/reflect

FieldTypeRequiredDescription
promptstringYesA directive describing what patterns or insights to look for (e.g. "What are the recurring themes in this user's goals?")
scopeobjectNoScope to reflect over
persistbooleanNoIf true, saves derived attributes to experiential memory (default: false)
kintegerNoNumber of memory records to consider during reflection (default: 20)
FieldTypeDescription
reflectionstringSynthesised insights in natural language
evidencearrayMemory records used as evidence for the reflection
persisted_attributesarrayAttributes written to experiential memory if persist was true
trace_idstringTrace record ID
Tool: memory_reflect
Input: {
"prompt": "What career themes emerge from this user's history?",
"scope": { "user": "alice", "org": "acme" },
"persist": true
}

Output: {
"reflection": "Alice consistently moves toward technical leadership roles and has a pattern of relocating for career advancement. Recent trajectory: engineer → CTO → VP of Engineering with international moves.",
"evidence": [...],
"persisted_attributes": [
{ "entity": "Person/alice", "key": "career_theme", "value": "technical leadership progression" }
],
"trace_id": "trace:01jt4p..."
}

Return the aggregated profile for the current principal. The profile groups identity facts, dynamic context, preferences, and active instructions into a single object suitable for direct system prompt injection.

REST equivalent: GET /api/v1/{context_id}/profile

FieldTypeRequiredDescription
scopeobjectNoScope identifying the principal. Uses the default scope if omitted.
FieldTypeDescription
identityobjectStatic identity facts (name, role, organisation, etc.)
dynamicobjectRecently updated contextual facts (current project, mood, focus area)
preferencesobjectStated preferences (language, response style, format)
instructionsarrayActive imperative instructions to apply during the session
trace_idstringTrace record ID
Tool: memory_profile
Input: {
"scope": { "user": "alice", "org": "acme" }
}

Output: {
"identity": {
"name": "Alice",
"role": "VP of Engineering",
"organisation": "Acme Corp",
"city": "Singapore"
},
"dynamic": {
"current_project": "Platform v3",
"focus": "Hiring for the Singapore office"
},
"preferences": {
"response_style": "concise",
"language": "British English"
},
"instructions": [
"Always respond in bullet points when listing more than three items",
"Do not include filler phrases such as 'Great question!'"
],
"trace_id": "trace:01jt4q..."
}

Search the authoritative knowledge base only (documents, structured records, connector-synced content). Does not include conversational memory. Returns ranked results with chunk text, score, and source metadata.

REST equivalent: POST /api/v1/{context_id}/query (or POST .../documents/query for authoritative passages only)

FieldTypeRequiredDescription
querystringYesNatural-language search query
modestringNoRetrieval mode: "vector", "bm25", "hybrid" (default), or "hybrid_graph"
kintegerNoNumber of results to return (default: 10)
thresholdnumberNoMinimum relevance score (0–1); results below this are excluded
scopeobjectNoScope filter
ModeDescription
vectorDense semantic search using HNSW index. Best for conceptual similarity.
bm25Sparse keyword search. Best for exact terminology, product names, and codes.
hybridCombines vector and BM25 with Reciprocal Rank Fusion. Recommended default.
hybrid_graphHybrid retrieval extended with graph density re-ranking. Best for multi-hop relational queries.
FieldTypeDescription
resultsarrayRanked result objects
results[].chunk_textstringThe text of the matched chunk
results[].scorenumberRelevance score (0–1)
results[].document_titlestringTitle of the source document
results[].document_idstringID of the source document
results[].chunk_idstringID of the specific chunk
results[].metadataobjectAdditional metadata attached during ingestion
trace_idstringTrace record ID
Tool: knowledge_search
Input: {
"query": "what is the refund policy for subscription plans?",
"mode": "hybrid",
"k": 5,
"scope": { "org": "acme" }
}

Output: {
"results": [
{
"chunk_text": "Subscription plans may be cancelled at any time. Refunds are issued on a pro-rata basis for the unused portion of the current billing period, provided the cancellation request is submitted within 14 days of the renewal date.",
"score": 0.94,
"document_title": "Acme Billing Policies v3",
"document_id": "document:01jt4r...",
"chunk_id": "chunk:01jt4s...",
"metadata": { "version": "3.0", "last_reviewed": "2026-03-01" }
}
],
"trace_id": "trace:01jt4t..."
}

Fetch a specific document, chunk, or knowledge node by its ID. Returns the full record without re-ranking or scoring. Use this when you already know which resource you need.

REST equivalent: GET /api/v1/{context_id}/documents/{id}

FieldTypeRequiredDescription
idstringYesThe ID of the document, chunk, or knowledge node to retrieve

The returned object shape depends on the record type:

Document:

FieldTypeDescription
idstringDocument ID
titlestringDocument title
content_typestringMIME type
chunk_countintegerNumber of chunks the document was split into
metadataobjectMetadata attached during ingestion
created_atstringISO 8601 datetime

Chunk:

FieldTypeDescription
idstringChunk ID
document_idstringParent document ID
textstringChunk text
positionintegerPosition within the document
Tool: knowledge_get
Input: { "id": "chunk:01jt4s..." }

Output: {
"id": "chunk:01jt4s...",
"document_id": "document:01jt4r...",
"text": "Subscription plans may be cancelled at any time...",
"position": 4
}

Semantically soft-delete memories matching a natural-language description. Spectron identifies relevant entities and attributes, marks them as deleted, and returns the count of records removed.

REST equivalent: POST /api/v1/{context_id}/forget

FieldTypeRequiredDescription
descriptionstringYesNatural-language description of what to forget (e.g. "anything about Alice's previous employer")
scopeobjectNoScope to restrict the deletion to
FieldTypeDescription
deleted_countintegerNumber of records soft-deleted
trace_idstringTrace record ID
Tool: memory_forget
Input: {
"description": "Alice's previous job title and employer",
"scope": { "user": "alice", "org": "acme" }
}

Output: {
"deleted_count": 3,
"trace_id": "trace:01jt4u..."
}

Soft-deleted records are excluded from all future retrieval but retained in the database for audit purposes. They can be permanently purged via the management API.

Was this page helpful?