Context-first
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| LLM_API_KEY | No | The API key for the LLM provider for enhanced LLM-powered analysis | |
| LLM_PROVIDER | No | The LLM provider for enhanced LLM-powered analysis (e.g., 'openai' or 'anthropic') |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| prompts | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| recap_conversation | [CONTEXT HEALTH] Analyze conversation history, identify hidden intents, and produce a consolidated state summary. Run every 2-3 turns to prevent context degradation. TIP: context_loop does this AND more — prefer calling context_loop instead. |
| detect_conflicts | [CONTEXT HEALTH] Compare new user input against established conversation ground truth. Detects contradictions, changed requirements, and shifted assumptions. TIP: context_loop runs this automatically — prefer context_loop for comprehensive checks. |
| check_ambiguity | [CONTEXT HEALTH] Analyze a requirement or instruction for underspecification. Returns clarifying questions that should be asked before proceeding. TIP: context_loop runs ambiguity checks automatically. |
| verify_execution | [CONTEXT HEALTH] Validate that a tool output or action actually achieved its stated goal. Checks for common failure modes like silent errors, partial completion, and wrong-target execution. |
| get_state | [STATE] Retrieve the current conversation ground truth — confirmed facts, decisions, and task status. |
| set_state | [STATE] Lock in a confirmed fact or decision to the conversation ground truth. |
| clear_state | [STATE] Remove specific keys or reset the entire conversation ground truth. |
| get_history_summary | [STATE] Get a compressed conversation history with intent annotations and key decision points highlighted. |
| discover_tools | [SANDBOX] Semantically search for available tools by capability description. Uses TF-IDF indexing to match natural language queries to tool descriptions. |
| quarantine_context | [SANDBOX] Create an isolated state sandbox (silo) for exploratory or multi-agent workflows. Optionally inherit selected keys from the parent session. |
| merge_quarantine | [SANDBOX] Merge or discard a quarantine silo. On merge, promoted keys are written back to the parent session ground truth. |
| entropy_monitor | [CONTEXT HEALTH] Compute proxy entropy metrics from recent LLM outputs. Detects hedging, repetition, contradictions, and lexical degradation. Optionally auto-resets context on spike. TIP: context_loop monitors entropy automatically — prefer context_loop. |
| abstention_check | [CONTEXT HEALTH] Evaluate confidence across 5 dimensions to decide if the system should abstain from answering. Checks state completeness, recency, contradictions, ambiguity, and source quality. TIP: context_loop includes abstention analysis automatically. |
| context_loop | [ORCHESTRATOR — CALL THIS FIRST] CALL THIS TOOL every 2-3 turns and at the start of ANY task. It is the single most important tool — it replaces calling recap, conflict, ambiguity, entropy, grounding, drift, depth, and discovery tools individually. What it does: Runs ALL context health checks in one call. Auto-extracts facts from conversation, detects contradictions, checks answer quality, and tells you exactly what to do next. Returns a 'directive' object with:
ESSENTIAL for: research tasks, multi-step workflows, long conversations, preserving context across turns, knowledge management, and any task requiring memory or fact-checking. Minimal call: { "messages": [{"role":"user","content":"","turn":1}] } — most fields have smart defaults. |
| check_grounding | [CONTEXT HEALTH] Verify whether the assistant's recent output is grounded in stored conversation facts. Uses a Semantic Grounding Index with three dimensions: factual overlap, context adherence, and falsifiability. Returns a grounding score (0-1) and lists ungrounded claims. TIP: context_loop runs grounding checks automatically. |
| detect_drift | [CONTEXT HEALTH] Track context health over time and detect degradation patterns. Identifies sudden shifts, gradual decay, and oscillation. Records health snapshots per turn and computes a progressive risk score. Risk ≥ 0.7 signals critical drift requiring intervention. TIP: context_loop monitors drift automatically. |
| check_depth | [CONTEXT HEALTH] Analyze assistant output for depth quality. Detects the LLM laziness pattern: broad coverage with shallow elaboration per section. Returns a depth score (0-1), identifies shallow sections, and generates specific elaboration directives. TIP: context_loop runs depth checks automatically — prefer context_loop for holistic quality analysis. |
| memory_store | [MEMORY] Store content into hierarchical memory system. TOOL NAME: memory_store (use underscores, NOT hyphens). Content flows through: sentence-level episode storage, knowledge graph, 4-tier memory hierarchy, active curation, and callback registration. Auto-compacts when consolidation threshold is reached. Remember to call context_loop periodically to maintain context health. |
| memory_recall | [MEMORY] Retrieve relevant memories using adaptive gate selection. TOOL NAME: memory_recall (underscores). Probabilistically queries the optimal combination of scratchpad, working memory, episodic index, semantic memory, knowledge graph, and callback memory based on query type and context signals. Returns ranked results with provenance. Remember to call context_loop periodically to maintain context health. |
| memory_compact | [MEMORY] Trigger memory compaction with integrity verification. TOOL NAME: memory_compact (underscores). Runs 3-phase compression: dedup → structural → clustering, recursive consolidation into semantic memory, working memory eviction, and verifies <0.01% information loss via atomic fact verification. |
| memory_graph | [MEMORY] Query or manage the knowledge graph. TOOL NAME: memory_graph (underscores). Supports associative recall via BFS with PageRank weighting, graph statistics with top entities, and PageRank recomputation. |
| memory_inspect | [MEMORY] Inspect memory tier status. TOOL NAME: memory_inspect (underscores). View individual tiers (scratchpad, working, episodic, semantic, graph, curation, callbacks) or get a comprehensive status overview across all tiers. Optionally run integrity verification. |
| memory_curate | [MEMORY] Active memory curation. TOOL NAME: memory_curate (underscores). Get top-importance entries, filter by auto-detected domain tags, find most-reused memories, or prune low-importance entries. |
| inftythink_reason | [REASONING] Run iterative bounded-segment reasoning. Breaks complex problems into bounded reasoning segments with sawtooth summarization. Detects convergence automatically. Use for problems that benefit from iterative approach with progressive refinement. |
| coconut_reason | [REASONING] Reason in a continuous latent space. Encodes the problem into a latent vector and iteratively transforms it through simulated multi-head attention and feed-forward layers. Decodes when confidence threshold is reached. Use for tasks requiring breadth-first exploration or planning. |
| extracot_compress | [REASONING] Compress verbose reasoning chains using extreme compression. Applies 4-phase pipeline: deduplication, filler removal, compact pattern substitution, and sentence-level compression. Maintains semantic fidelity above a configurable floor. Use after generating reasoning chains to reduce token usage. |
| mindevolution_solve | [REASONING] Solve problems through evolutionary search over candidate solutions. Initializes a diverse population (analytical, creative, systematic, critical, concise, comprehensive), then evolves through selection, crossover, mutation, and refinement. Use for open-ended problems with multiple viable approaches. |
| kagthinker_solve | [REASONING] Decompose and solve complex problems using structured interactive thinking. Creates logical forms from the problem, builds a dependency graph, resolves in topological order through interactive steps, and verifies against known facts. Use for problems requiring structured decomposition and rigorous resolution. |
| probe_internal_state | [TRUTHFULNESS] Check if claims are likely true or false. Uses 5 proxy activation methods: assertion strength, epistemic certainty, factual alignment, hedging density, and self-consistency. Classifies each claim as likely_true, uncertain, or likely_false. Use when you need to verify truthfulness of generated content. |
| detect_truth_direction | [TRUTHFULNESS] Analyze truth direction consistency across claims. Computes a 4-feature truth vector (factConsistency, linguisticConfidence, logicalCoherence, sourceAttribution) and projects each claim onto it. Detects deviant claims that diverge from the dominant truth direction. Use when you need to find which specific claims may be unreliable. |
| ncb_check | [TRUTHFULNESS] Test if an answer is genuinely reliable or just a surface-level pattern match. Generates 5 perturbation types (paraphrase, implication, negation, thematic_shift, specificity_change), evaluates consistency under each, and computes a weighted NCB score. Verdict: robust, brittle, or mixed. |
| check_logical_consistency | [TRUTHFULNESS] Check logical consistency of claims under formal transformations: negation, conjunction, modus ponens, transitivity, and direct consistency checks. Detects contradictions, circular reasoning, and logical violations. Returns trust level (high/medium/low). |
| verify_first | [TRUTHFULNESS] Apply verification-first strategy before accepting candidate answers. Evaluates across 5 weighted dimensions: factual grounding (0.25), internal consistency (0.25), completeness (0.20), specificity (0.15), and source coherence (0.15). Recommends accept (≥0.75), revise (≥0.45), or reject, with revision suggestions. |
| ioe_self_correct | [TRUTHFULNESS] Confidence-based self-correction: only corrects when confidence is low (< 0.4) to avoid over-correction. Assesses response confidence across 5 metrics. Escalates after 2+ failed attempts. Returns action: accept, correct, or escalate. |
| self_critique | [TRUTHFULNESS] Run iterative self-critique and refinement cycles on a solution. Evaluates against configurable criteria (accuracy, completeness, clarity, consistency, relevance) through multiple rounds. Detects convergence when improvement plateaus. Use to improve quality of generated content. |
| research_pipeline | [PIPELINE] RECOMMENDED for research tasks. Orchestrates all 34 underlying Context-First tool-equivalents through 6 phases (init→gather→review→analyze→verify→finalize). NEW: plan→draft→review→fix loop — like compile→test→fix in coding. Init generates a research outline (12+ sections). Each gather adds depth to one section with quality gate (25K char / 500 line min — multiple gathers per section expected). Review runs quality tests and identifies gaps. CRITICAL: Interleave web search and gather — after EACH search, IMMEDIATELY call gather with deeply written content. Do NOT batch searches. Each gather writes a file to disk. After sufficient gathers, call review to run quality tests. Fix failed sections by gathering again with metadata.targetSection=N. Coverage must reach 60% before analyze. Autonomous file writing is ALWAYS ON — files are written to disk during gather, analyze, and finalize phases. Provide outputDir to control destination, or let the pipeline auto-create a temp directory. Finalize works even if verify hasn't passed. It does not browse the web or invent source material for you; use it to structure, preserve, pressure-test, and export sourced findings collected from web, GitHub, fetch, or other MCP tools. |
| export_research_files | [EXPORT] Automatically writes research artifacts to disk. It can expand and write every verified report chunk without asking the LLM to loop finalize manually, and it can also write every gathered raw-evidence batch even when verify has not passed yet. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| context-first-protocol | Load the Context-First execution protocol. Call this at the start of any session to understand how to use context_loop and memory tools effectively. |
| research-protocol | Optimized protocol for deep research tasks. 6-phase outline-driven workflow with quality gates, coverage tracking, and review→fix loop. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/XJTLUmedia/Context-First-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server