Tools Reference
Complete reference for all 16 C3 MCP tools โ parameters, actions, examples, and usage notes.
All Tools
The primary discovery tool. Always use before Grep or Glob. Returns ranked results with file locations and surrounding context. Supports TF-IDF code search, embedding-based semantic search, file discovery, and exact regex search.
| Parameter | Type | Default | Description |
|---|---|---|---|
| query | string | required | Search query โ natural language or code pattern |
| action | string | "code" | code TF-IDF search ยท files file discovery ยท semantic embedding similarity ยท exact regex match ยท transcript session history search |
| top_k | int | 3 | Max results to return |
| prefetch | bool | false | Auto-compress top result files in parallel after search |
| max_tokens | int | 1200 | Token budget for results |
Examples
# Find code by content
c3_search(query='session snapshot restore', action='code')
# Find files by name/path
c3_search(query='hook files in cli/', action='files')
# Semantic similarity search
c3_search(query='code that handles authentication expiry', action='semantic')
# Exact regex match
c3_search(query='class.*Manager', action='exact', top_k=10)
# With auto-prefetch of top results
c3_search(query='memory consolidation', action='code', prefetch=True)
Read specific symbols (functions, classes, methods) or exact line ranges from a file. Always use after c3_compress to get the line map. Never read entire files.
| Parameter | Type | Default | Description |
|---|---|---|---|
| file_path | string | required | Relative path to the file |
| symbols | array | null | Symbol names to read: ["ClassName.method_name"] or ["function_name"] |
| lines | string | null | Line range: "100-150" or "100" |
Examples
# Read specific symbols
c3_read(file_path='services/session_manager.py', symbols=['SessionManager.save', 'SessionManager.restore'])
# Read by line range (from compress map)
c3_read(file_path='cli/c3.py', lines='660-720')
# Read a standalone function
c3_read(file_path='services/memory.py', symbols=['recall_facts'])
Returns a compact structural summary of one or more files. Use before c3_read to understand file structure and get the line numbers needed for targeted reads. Supports batch (comma-separated paths).
| Parameter | Type | Default | Description |
|---|---|---|---|
| file_path | string | required | Single path or comma-separated list of paths |
| mode | string | "smart" | map symbol line-map ยท dense_map map + docstrings ยท smart adaptive ยท diff recent changes ยท bug_scan suspicious patterns ยท ast knowledge-graph via codebase-memory-mcp |
Examples
# Map a single file
c3_compress(file_path='cli/mcp_server.py', mode='map')
# Map multiple files in one call
c3_compress(file_path='services/memory.py,services/agents.py', mode='map')
# See recent changes
c3_compress(file_path='cli/c3.py', mode='diff')
# Quick bug scan
c3_compress(file_path='services/embedding_index.py', mode='bug_scan')
# Knowledge-graph overview (requires codebase-memory-mcp installed)
c3_compress(file_path='.', mode='ast')
map output includes line numbers for every symbol. Use those line numbers directly in c3_read(lines=โฆ) to read specific sections.
The
ast mode uses codebase-memory-mcp (optional install) for a project-wide knowledge graph โ languages, entry points, hotspots, HTTP routes, and module clusters.
Filters noisy terminal output, log files, or JSONL data to return only relevant lines. Use whenever command output exceeds ~10 lines. Supports inline text or file path input.
| Parameter | Type | Default | Description |
|---|---|---|---|
| text | string | "" | Raw terminal output to filter (inline) |
| file_path | string | "" | Path to a log or data file to filter |
| pattern | string | "" | Regex pattern to filter by (e.g. "error|warning") |
Examples
# Filter inline terminal output
c3_filter(text="<pytest output with 200+ lines>")
# Filter a log file for errors
c3_filter(file_path=".c3/sessions/session_042.json", pattern="error|fail")
# Filter build output
c3_filter(text="<webpack build output>", pattern="warning|error")
The only way to edit files in C3. Validates the old_string match, applies the patch, writes the file, and logs the change to the edit ledger. Supports single edits and batched edits to the same file. Can be called in parallel for different files.
| Parameter | Type | Default | Description |
|---|---|---|---|
| file_path | string | required | Relative path to the file to edit |
| old_string | string | "" | Exact text to find and replace (must be unique in the file) |
| new_string | string | "" | Replacement text |
| summary | string | "" | Human-readable description of the change (logged to ledger) |
| edits | array | null | List of {old_string, new_string} objects for batch edits to the same file |
Single edit
c3_edit(
file_path='services/auth.py',
old_string='return token.expiry > now',
new_string='return token.expiry > now + CLOCK_SKEW',
summary='Add clock skew buffer to token expiry'
)
Batch edits to same file
c3_edit(
file_path='core/config.py',
edits=[
{"old_string": "DEBUG = True", "new_string": "DEBUG = False"},
{"old_string": "LOG_LEVEL = 'DEBUG'", "new_string": "LOG_LEVEL = 'WARNING'"}
],
summary='Production config hardening'
)
old_string uses straight quotes but the file has curly quotes (or vice versa), or the two differ only by ASCII vs. unicode dashes (-/โ/โ) or non-breaking spaces, c3_edit retries with a normalized match and splices your new_string in at the matched offsets โ unrelated lookalikes elsewhere are left intact. The response is tagged [unicode-normalized] when the fallback was used.
Runs the appropriate native syntax checker for each file type. Supports comma-separated batch validation. Always call after c3_edit and before reporting done. If pyright (Python) or tsc (TypeScript) is on PATH, also runs a deep type check and reports type errors as advisory warnings alongside the PASS result.
| Parameter | Type | Default | Description |
|---|---|---|---|
| file_path | string | required | Single path or comma-separated list of paths |
Examples
# Single file
c3_validate(file_path='services/memory.py')
# Batch (runs in parallel)
c3_validate(file_path='cli/c3.py,cli/mcp_server.py,services/agents.py')
Supported file types
Finds every file that references a symbol (function, class, variable) before you rename or remove it. Uses git grep for speed with a pure-Python fallback. Groups results by file, scores risk (SAFE / LOW / MEDIUM / HIGH), and in unstaged mode overlays which affected files have uncommitted changes.
| Parameter | Type | Default | Description |
|---|---|---|---|
| target | string | required | Symbol name, function, or class to analyse |
| file_path | string | "" | Source file to exclude from results (the definition site) |
| mode | string | "symbol" | symbol cross-project reference scan ยท unstaged overlay uncommitted-change files |
Examples
# Check blast radius before renaming a function
c3_impact(target='handle_memory', file_path='cli/tools/memory.py')
# Which affected files also have uncommitted changes?
c3_impact(target='MemoryStore', mode='unstaged')
# Safe to remove? (check before deleting)
c3_impact(target='_legacy_compress')
Risk levels
c3_impact before c3_edit whenever you're renaming, removing, or changing the signature of a shared symbol. A HIGH risk result means you need to update all call sites in the same edit pass.
Run a shell command through C3 with structured returns (exit_code, stdout, stderr, duration_ms), hard timeout + taskkill /F /T on Windows, auto-filter of long stdout, and automatic edit-ledger entries for git-mutating commands. Use for tests, git, builds, and one-shot scripts. Native Bash remains the fallback for interactive / TTY commands (gh pr create with editor, ollama run).
| Parameter | Type | Default | Description |
|---|---|---|---|
| cmd | string | required | Shell command to execute (runs via subprocess.Popen(shell=True)) |
| cwd | string | "" | Working directory. Defaults to the project root |
| timeout | int | 60 | Seconds before the process is killed with taskkill /F /T (Win) or SIGKILL. Capped at 600 |
| filter_output | bool | True | Auto-route stdout through c3_filter when it exceeds 30 lines |
| log | bool | True | Write shell_exec to the activity log and auto-log git-mutating commands to the edit ledger |
Examples
# Run tests โ exit_code propagates, long output is filtered
c3_shell(cmd='pytest tests/test_c3_shell.py -v')
# Git mutation โ affected files auto-recorded in the edit ledger
c3_shell(cmd='git commit -m "wire c3_shell"')
# Build with a longer timeout
c3_shell(cmd='npm run build', timeout=300)
Safety classification
The blocklist is a best-effort guard against the most catastrophic commands โ not a sandbox. c3_shell runs arbitrary commands by design; for an intentionally dangerous command, use native Bash with explicit approval.
c3_shell over native Bash for anything noisy, git-mutating, or long-running. You get structured returns, consistent Windows timeout behaviour, free output filtering, and ledger coupling. Fall back to native Bash only for interactive / TTY commands.
Manages the session lifecycle. Use log to record decisions, snapshot before /clear, restore to recover after /clear, and compact for a one-step restart. Session data persists in .c3/sessions/.
| Parameter | Type | Default | Description |
|---|---|---|---|
| action | string | required | See action table below |
| data | string | "" | Content for log/plan actions |
| reasoning | string | "" | Optional rationale for log entries |
Actions
| Action | Read-only? | Description |
|---|---|---|
| start | โ | Start a new session (auto-called on server start) |
| log | โ | Record a decision or note to the session |
| plan | โ | Record a plan or approach |
| snapshot | โ | Save full session state (call before /clear) |
| restore | โ | Restore last session snapshot (call after /clear) |
| compact | โ | One-step snapshot + summary + restore prompt |
| convo_log | โ | Search session conversation history |
Examples
# Log a decision
c3_session(action='log', data='Chose Redis over memcached โ TTL support needed', reasoning='Session persistence required')
# Before /clear
c3_session(action='snapshot')
# After /clear
c3_session(action='restore')
# One-step restart
c3_session(action='compact')
Persistent key-fact store that survives /clear and session restarts. Use recall at session start to recover context. Facts are stored with salience scores and auto-decayed over time. Supports semantic recall, explicit query, and manual management.
| Parameter | Type | Default | Description |
|---|---|---|---|
| action | string | required | See action table below |
| fact | string | "" | Fact text for add and update |
| query | string | "" | Search query for recall and query |
| category | string | "general" | Fact category: general, architecture, convention, feedback |
| fact_id | string | "" | Fact ID for update and delete |
| top_k | int | 3 | Max facts to return |
Actions
| Action | Read-only? | Description |
|---|---|---|
| recall | โ | Semantic recall of top-k relevant facts for a query |
| query | โ | Exact/keyword search over facts |
| list | โ | List all facts (optionally by category) |
| add | โ | Add a new persistent fact |
| update | โ | Update an existing fact by ID |
| delete | โ | Delete a fact by ID |
| review | โ | Review facts for staleness / deduplication |
| consolidate | โ | Merge duplicate/redundant facts |
| score | โ | Show salience scores for all facts |
| trends | โ | Show memory usage trends over time |
| graph | โ | Show fact relationships graph |
| ground | โ | Ground facts against current codebase (verify still accurate) |
| export | โ | Export all facts as JSON |
| lifespan | โ | Show fact age and decay information |
Examples
# Session start โ recall relevant facts
c3_memory(action='recall', query='authentication token system', top_k=5)
# Add a new fact
c3_memory(action='add', fact='[architecture] JWT tokens use RS256 โ public key in /etc/c3/jwt.pub', category='architecture')
# Save a convention
c3_memory(action='add', fact='[convention] All new API handlers must call audit_log() before returning', category='convention')
# Verify facts are still accurate
c3_memory(action='ground')
# List all architecture facts
c3_memory(action='list', category='architecture')
Project and session status dashboard. Check token budget, server health, pending notifications, and active session summary.
| Parameter | Type | Default | Description |
|---|---|---|---|
| view | string | "budget" | budget token budget ยท health server health ยท notifications pending alerts ยท sessions session list |
| detailed | bool | false | Include extended metrics |
Examples
c3_status(view='budget') # Token budget remaining
c3_status(view='health') # MCP server + services health
c3_status(view='notifications') # Pending alerts (budget warnings, etc.)
c3_status(view='sessions') # Recent sessions list
Delegates tasks to local or remote AI backends to save Claude tokens on routine work (summarization, routing, simple Q&A). Supports automatic backend selection based on task type.
| Parameter | Type | Default | Description |
|---|---|---|---|
| task | string | required | The task or question to delegate |
| task_type | string | "ask" | ask general Q&A ยท summarize summarization ยท auto let C3 route optimally |
| context | string | "" | Additional context to include with the task |
| backend | string | "auto" | ollama ยท codex ยท gemini ยท claude ยท auto |
Examples
# Delegate summarization to local Ollama
c3_delegate(task='Summarize what this function does', context='<function code>', backend='ollama', task_type='summarize')
# Auto-route based on task type
c3_delegate(task='What is the purpose of this config key?', context='<config snippet>', backend='auto')
ollama backend. Codex and Gemini backends require their respective CLIs. The claude backend uses the Claude Code CLI in non-interactive print mode (claude -p) โ no extra config needed if Claude Code is installed. Use task_type='available' to check which of the 4 backends are reachable.
Executes compound multi-step workflows using multiple C3 tools in sequence. Useful for common patterns like reviewing changes, preparing context, or running a preflight check.
| Parameter | Type | Default | Description |
|---|---|---|---|
| workflow | string | required | Workflow name โ see workflow table below |
| scope | string | "" | File paths or focus area for the workflow |
| context | string | "" | Additional context to pass into the workflow |
Available workflows
| Workflow | What it does |
|---|---|
| available | List all available workflows with descriptions |
| review_changes | Compress recently changed files + summarize what changed |
| prepare_context | Search + compress files relevant to a scope/topic |
| investigate | Multi-step investigation: search โ compress โ summarize โ recommend |
| preflight | Pre-task check: recall memory + status + recent changes |
| validate_compress | Batch validate + compress a set of files |
Examples
# Run a preflight before starting work
c3_agent(workflow='preflight', context='starting auth refactor')
# Prepare context for a specific area
c3_agent(workflow='prepare_context', scope='services/memory.py,services/agents.py')
# Review what changed recently
c3_agent(workflow='review_changes')
# Deep investigation
c3_agent(workflow='investigate', context='why does session restore fail after compact?')
Access the edit ledger โ a persistent append-only log of all file changes made through c3_edit. Provides history, version diffing, stats, and tagging. The ledger is also enriched in the background by the EditLedgerEnricherAgent. Since v2.35.0, each entry is stamped with the git branch and HEAD it was made on, and history can be filtered by branch.
| Parameter | Type | Default | Description |
|---|---|---|---|
| action | string | required | See action table below |
| file | string | "" | Filter by file path |
| change_type | string | "modified" | Change type for log action |
| branch | string | "" | Filter history to edits stamped with this git branch v2.35.0 |
Actions
| Action | Description |
|---|---|
| log | Manually log an edit to the ledger (normally done automatically by c3_edit) |
| history | Show edit history (optionally filtered by file and/or branch) |
| versions | Show version history for a specific file |
| stats | Aggregate stats: most-edited files, change frequency |
| tag | Tag an edit entry with a label |
Examples
# Show recent edit history
c3_edits(action='history')
# Version history for a specific file
c3_edits(action='versions', file='services/memory.py')
# Ledger stats
c3_edits(action='stats')
# Edits made on a specific branch
c3_edits(action='history', branch='feature/x')
Connect to a self-hosted enterprise Bitbucket server and operate on it. Tokens live in the OS keyring (Windows Credential Manager / macOS Keychain / Linux Secret Service); only a non-secret index of accounts and the active-account pointer is written to .c3/config.json. Project key + repo slug fall back to the configured defaults.
Setup: c3 bitbucket login --url <URL> (interactive PAT prompt), then c3 bitbucket set-default --project PROJ --repo my-repo. See the Bitbucket integration guide for the full action reference, Hub UI tour, audit-trail integration, and troubleshooting.
Actions
| Action | Group | Description |
|---|---|---|
| status | Read | Active account, accounts list, defaults, server-version probe |
| whoami | Read | Current authenticated user (PAT owner) |
| list_projects, list_repos, get_repo | Read | Project / repository discovery |
| list_prs, get_pr, get_pr_diff, get_pr_activities | Read | PR browsing + diff + activity feed |
| create_pr, comment_pr, approve_pr, unapprove_pr, decline_pr, merge_pr | Write | PR write actions. merge_pr and decline_pr auto-fetch the PR's current version |
| list_branches, create_branch, delete_branch | Branch | Branch listing and admin (uses the branch-utils API) |
| list_commits, list_activity, build_status | Read | Recent commits, activity, build/CI status (defaults to default-branch HEAD) |
| repo_settings, update_repo_settings, list_webhooks, create_webhook, delete_webhook, list_permissions | Admin | Repository administration |
Examples
# Connection probe + active account info
c3_bitbucket(action='status')
# List open PRs in the default repo
c3_bitbucket(action='list_prs', state='OPEN')
# Open a PR
c3_bitbucket(action='create_pr',
title='Add Bitbucket integration',
from_branch='feat/bitbucket',
to_branch='main',
reviewers='alice,bob')
# Approve and merge โ version is fetched automatically
c3_bitbucket(action='approve_pr', pr_id=42)
c3_bitbucket(action='merge_pr', pr_id=42)
Audit trail: mutating actions (merge_pr, create_branch, delete_branch, webhook writes, etc.) are appended to the C3 edit ledger so the local audit log covers platform-side state changes too.
Reach outside the current workspace. C3 keeps a global registry of installed projects (~/.c3/projects.json); c3_project lists/scans them and proxies the core C3 operations against any one โ building and caching a full runtime per target project on demand. Name the target by registered name or absolute path (a .c3 directory is required).
Write safety: read ops run freely; mutating ops (edit, shell, and memory add/update/delete) are refused unless you pass allow_write=true, and every foreign mutation is recorded on the target project's activity log and edit ledger.
Actions
| Action | Group | Description |
|---|---|---|
| list | Discover | Registered projects (fast; registry only) |
| scan | Discover | Registry + bounded filesystem scan for unregistered .c3 projects nearby |
| info, register, unregister | Discover | Project details / add to / remove from the registry |
| search, read, compress, status, memory, impact, edits, validate, filter | Read | Proxy the matching c3_* tool against the target project |
| edit, shell, memory(add/update/delete) | Write | Mutate the target project โ require allow_write=true |
Examples
# Which projects have C3 installed?
c3_project(action='list')
c3_project(action='scan') # also finds unregistered .c3 dirs nearby
# Search / read inside another project
c3_project(action='search', project='SafeMirror', query='token bucket')
c3_project(action='read', project='SafeMirror', file_path='core/limiter.py', symbols='RateLimiter')
# Memory recall from another project's fact store
c3_project(action='memory', project='Sentinel', mem_action='recall', query='auth flow')
# Guarded write โ the edit lands in the target project's ledger
c3_project(action='edit', project='Sentinel',
file_path='README.md',
old_string='v1', new_string='v2',
allow_write=true)
Sub-action params: search_action (code/files/semantic/โฆ), mem_action (recall/index/fetch/add/โฆ), and edits_action (history/versions/stats) pick the operation for those verbs; scan_roots (comma-separated) overrides where scan looks.