Tools and MCP

Use the same MARS actions from agents, CLI, and MCP.

Tools are the actions MARS is allowed to take: read files, run checks, update tickets, write release notes, inspect trust, and more. The same actions are available to MARS agents, to mars tools run, and to local AI clients through MCP.

Govern before extending: MCP exposes MARS tools to local clients. Execution profile is the outer gate: start with observer, then use trust, guardrails, and role allowlists before acknowledged-host mutation.

Ways To Use Tools

Use tools when you want a repeatable action with the same repo path, trust rules, JSON input, and output limits that agents use.

SurfaceCommandUse
Discover toolsmars tools list --jsonPrint OpenAI-style tool definitions from the registered built-in registry.
Run one toolmars tools run <name> --repo /path --args-json '{...}'Execute a registered tool through the same executor and policy path as agents.
Expose MCPmars mcp serve --repo /path --trust observerLaunch a stdio MCP server for local clients.
Role agent runsmars run engineer --repo /pathTools are filtered by execution profile, then role trust, manifest allowlist, and policy.
Harness manifest.harness/manifest.yamlTarget owners decide which tools each role may use.

List Tools

Use tools list when you need to see what the installed binary actually exposes. The JSON form is the best input for another model, MCP adapter, or local integration.

Human list

mars tools list

Prints one registered tool name per line.

Machine-readable definitions

mars tools list --json

Prints tool names, descriptions, and JSON schemas in an OpenAI-style format.

Run A Tool From The CLI

tools run executes one tool with JSON object arguments. It resolves the repository root, applies the requested trust level, enforces output limits, and returns either formatted model output or structured JSON.

Inspect git state

mars tools run git_status \
  --repo ~/my-project \
  --args-json '{}' \
  --json

Search files with a registered tool

mars tools run grep \
  --repo ~/my-project \
  --args-json '{"pattern":"MarsDocSync","glob":"**/*.go"}'

Run a mutating tool deliberately

mars tools run record_decision \
  --repo ~/my-project \
  --trust contributor \
  --execution-profile host \
  --acknowledge-host-execution \
  --args-json '{"title":"Use local model override","decision":"Route engineer to repo-coder for validation."}'

Observer profile independently blocks mutating tools. Host execution has the current OS user's full authority and is not containment; contributor trust remains a separate gate.

Limit output for external clients

mars tools run file_read \
  --repo ~/my-project \
  --max-output-bytes 6000 \
  --args-json '{"path":"README.md"}'

MCP Server

mars mcp serve starts a newline-delimited JSON-RPC stdio MCP server. Configure an MCP-compatible client to launch the command locally. The server exposes tools/list and tools/call against the MARS tool registry.

Observer MCP server

mars mcp serve \
  --repo ~/my-project \
  --trust observer \
  --role mcp-client

Use observer by default. It can inspect, but mutating tools are blocked.

Acknowledged-host contributor MCP server

mars mcp serve \
  --repo ~/my-project \
  --trust contributor \
  --execution-profile host \
  --acknowledge-host-execution \
  --role mcp-client \
  --allowlist file_read,grep,mars_cli,git_status,record_decision

Use acknowledged host plus contributor trust only for a trusted local client and keep the allowlist as narrow as possible. Host acknowledgement does not upgrade trust.

Example client entry

{
  "mcpServers": {
    "mars": {
      "command": "mars",
      "args": [
        "mcp",
        "serve",
        "--repo",
        "/absolute/path/to/my-project",
        "--trust",
        "observer"
      ]
    }
  }
}

Use an absolute repo path so the MCP client does not depend on its launch directory.

Trust And Allowlists

MARS applies three separate gates: execution profile must admit the authority, trust must permit the action, and the tool must be exposed by the allowlist. Role runs also use the role's manifest allowlist; target configuration cannot grant host authority.

GateWhere it is setHow users should apply it
Execution profile--execution-profile observer|host|isolatedObserver is the default and blocks every mutator. Host requires --acknowledge-host-execution; isolated is unavailable.
Role manifest allowlist.harness/manifest.yamlGive each role the smallest tool set that can do its job.
CLI run allowlistmars tools run --allowlistDefaults to the named tool. Use only when a tool call needs a specific set.
MCP allowlistmars mcp serve --allowlistUse a narrow list for external clients, especially with contributor trust.
Observer trust--trust observerSafe default for read-only inspection. Mutating tools are blocked.
Contributor trust--trust contributorPermits governed mutation only inside acknowledged-host execution.
Autonomous trustRole trust store and policy.Reserved for roles that have earned more autonomy through evidence.

Inspect trust

mars trust --repo ~/my-project

Set trust explicitly

mars trust set engineer ~/my-project contributor \
  --reason "Human approved bounded write access"

Use the target repo path for the common path. Advanced repo-ID-oriented edits should pass the matching --db and line up with registered state.

Built-In Tool Categories

The exact installed set is authoritative from mars tools list. These categories explain how users should think about the built-in surface.

CategoryRepresentative toolsUser purpose
File inspectionfile_read, file_search, grep, code-intel toolsRead known files, search bounded globs, and inspect code graph context. See the Code Intelligence Reference.
File mutationfile_writeCreate or update repo files with docsync and policy checks.
Shell executionshell_execRun subprocesses through policy, validation, background process, and output controls. Commands still have the current operating-system user's full authority; these controls are not a security sandbox.
MARS command bridgemars_cliRun MARS commands through a structured argv path that avoids stale binary and shell parsing mistakes.
Git lifecyclegit_status, git_commit, git_pushInspect, commit, and publish work under trunk and safety rules.
Ticket and planningticket_create, record_decision, disposition toolsCreate durable work and decisions rather than leaving them in chat.
Documentation and doctrinedocsync_audit, doctrine sync toolsKeep code, feature contracts, design docs, and generated harness doctrine aligned.
Dependency and workspace healthdependency_sync, workspace_hygieneRepair dependencies and detect unsafe workspace state.
Meta toolstool_create, persona_create, tool_creation_guardCreate or validate new tools and personas through governed paths.

Tool Selection Rules

Users and external agents should choose the most specific governed capability that fits the job. This makes runs easier to audit and keeps safety policy effective.

Use mars_cli for MARS behavior

Setup, init, upgrade, doctor, scan, run, start, release, scores, trust, models, and update workflows belong through mars_cli in agent runs.

Use file tools for repo files

Prefer file_read, file_search, and grep for ordinary inspection. Use file_write for controlled mutation.

Use shell only when needed

shell_exec is host-only and is for tests, builds, runtime probes, and subprocesses where no purpose-built tool fits. Treat every permitted command as host execution with the current operating-system user's full authority.

Use durable records for decisions

Important discoveries, architecture decisions, and intervention outcomes belong in repo artifacts through the appropriate tools.

Tool Creation

Repeated, risky, validation-heavy, or likely-to-recur procedures should become first-class tools instead of staying as chat memory or ad hoc shell scripts. New built-in tools must originate through tool_create unless a prior durable decision explains why the meta-tool path was bypassed.

  1. Confirm the trigger

    Create a tool when the process is repeated, risky, validation-heavy, or broadly reusable across foundation and deployed harnesses.

  2. Run the meta-tool

    mars tools run tool_create \
      --repo . \
      --trust contributor \
      --execution-profile host \
      --acknowledge-host-execution \
      --args-json '{"tool_name":"example_tool"}'
  3. Finish implementation and tests

    Complete the generated Go implementation, registration, trust policy, allowlists, tests, and documentation.

  4. Validate the path

    mars tools run tool_creation_guard \
      --repo . \
      --args-json '{"tool_name":"example_tool"}'

External AI Clients

External clients should treat MARS as the source of tool truth rather than recreating local shell shortcuts. Use observer profile for read-only support and acknowledged host plus contributor trust only when the client should mutate the repo.

Client needRecommended setupWhy
Read-only repository understanding.mars mcp serve --repo /path --trust observer --allowlist file_read,file_search,grep,git_statusPrevents accidental mutation while still exposing useful context tools.
MARS lifecycle command access.Add mars_cli to the allowlist.Routes MARS commands through the active harness executable and structured args.
Controlled docs or ticket edits.Use acknowledged host plus contributor trust with file_read,file_write,git_status,record_decision,ticket_create.Allows mutation while keeping policy, docsync, and durable-record rules active.
Tool development.Use acknowledged host plus contributor trust and include tool_create, tool_creation_guard, test tools, and git tools.Keeps formalized tool creation auditable.

Troubleshooting

SymptomLikely causeUser action
tools run says a tool is not allowed.The named tool is outside the active allowlist.Pass a narrower correct --allowlist, or use the default named-tool allowlist.
A mutating tool is blocked.The execution profile or trust level is observer.Use --execution-profile host --acknowledge-host-execution --trust contributor only when mutation and current-user host authority are intended and authorized.
MCP client cannot find repo files.The MCP server was launched with the wrong working directory or a relative repo path.Configure --repo /absolute/path/to/repo.
Output is truncated.The executor output budget was reached.Use a more specific tool query or raise --max-output-bytes deliberately.
Direct shell MARS command fails in an agent run.Policy prefers the mars_cli tool for MARS commands.Use mars_cli or the operator CLI outside the agent run.
New tool work fails review.The governed tool_create path or documentation sync was skipped.Run tool_creation_guard, update design docs, tests, registration, allowlists, and MarsDocSync metadata.