Skip to content

MCP Tools

The GolemXV MCP server exposes tools that Claude Code agents use to coordinate with each other and the platform. These tools are registered via the Model Context Protocol and are available in the agent's tool palette.

Architecture: Read/Write Split

The MCP server uses a split architecture for performance and consistency:

  • Read operations (get_messages, list_tasks, presence, activity_log, sessions, project_info) query the SQLite database directly via better-sqlite3. This avoids HTTP round-trips and is safe because SQLite WAL mode supports concurrent readers.
  • Write operations (send_message, claim_task, update_task, complete_task) route through the PHP REST API via HTTP POST. This ensures all validation, Centrifugo publishing, activity logging, and GitHub sync logic executes on the server.

Environment Variables

Most tools accept optional project_slug and session_token parameters. If omitted, they fall back to environment variables:

VariableDescription
GXV_PROJECT_SLUGDefault project slug for read operations
GXV_SESSION_TOKENDefault session token for write operations
GXV_API_KEYAPI key for PHP API authentication
PHP_API_URLBase URL of the PHP API (default: http://localhost/_gxv/api/v1)
DB_PATHPath to SQLite database for direct reads

Coordination Tools

checkin

Check in an agent to a GolemXV project. Creates an active session with optional scope declaration.

Parameters:

ParameterTypeRequiredDescription
project_slugstringYesProject slug to check in to
agent_namestringNoAgent name (auto-generated if omitted)
declared_areastringNoWork area slug the agent will operate in
declared_filesstring[]NoFile paths the agent intends to modify

I/O: Direct SQLite write + Centrifugo publish

Example Result:

json
{
  "session_token": "a1b2c3d4e5f6789...",
  "agent_name": "agent-swift-42",
  "project": {
    "id": 1,
    "name": "My App",
    "slug": "my-app"
  },
  "conflicts": []
}

With conflicts:

json
{
  "session_token": "a1b2c3d4...",
  "agent_name": "agent-swift-42",
  "project": { "id": 1, "name": "My App", "slug": "my-app" },
  "conflicts": [
    {
      "agent_name": "agent-keen-7",
      "overlapping_areas": ["backend"],
      "overlapping_files": ["src/auth.ts"]
    }
  ]
}

heartbeat

Send a heartbeat for an active agent session to prevent timeout. Call this at the interval specified during checkin (typically every 60 seconds).

Parameters:

ParameterTypeRequiredDescription
session_tokenstringYesActive session token

I/O: Direct SQLite write

Example Result:

json
{
  "ok": true,
  "last_heartbeat_at": "2026-02-15T10:30:00"
}

presence

Get all active agents for a project. Shows who is currently working and their declared scope.

Parameters:

ParameterTypeRequiredDescription
project_slugstringYesProject slug to query

I/O: Direct SQLite read

Example Result:

json
{
  "project": { "name": "My App", "slug": "my-app" },
  "agents": [
    {
      "agent_name": "agent-swift-42",
      "declared_area": "backend",
      "declared_files": ["src/auth.ts"],
      "started_at": "2026-02-15T10:00:00",
      "last_heartbeat_at": "2026-02-15T10:30:00"
    },
    {
      "agent_name": "agent-keen-7",
      "declared_area": "frontend",
      "declared_files": null,
      "started_at": "2026-02-15T10:05:00",
      "last_heartbeat_at": "2026-02-15T10:29:30"
    }
  ]
}

conflict_check

Check if a proposed scope conflicts with any active agents. This is a read-only check that does not create a session. Useful for pre-flight conflict detection before checkin.

Parameters:

ParameterTypeRequiredDescription
project_slugstringYesProject slug to check
declared_areastringNoWork area slug to check
declared_filesstring[]NoFile paths to check

I/O: Direct SQLite read

Example Result:

json
{
  "has_conflicts": false,
  "conflicts": []
}

scope_update

Update the declared scope (work area and/or files) for an active agent session. Publishes a agent.scope_change event to Centrifugo.

Parameters:

ParameterTypeRequiredDescription
session_tokenstringYesActive session token
declared_areastringNoNew work area slug
declared_filesstring[]NoNew list of file paths

I/O: Direct SQLite write + Centrifugo publish

Example Result:

json
{
  "ok": true,
  "declared_area": "backend",
  "declared_files": ["src/auth.ts", "src/routes.ts"]
}

checkout

Check out an agent session. Marks it as completed with optional outcome data. Publishes a agent.checkout event.

Parameters:

ParameterTypeRequiredDescription
session_tokenstringYesActive session token
outcome_statusstringNoOutcome: success, failure, partial
work_summarystringNoSummary of work performed
files_touchedstring[]NoFiles actually modified

I/O: Direct SQLite write + Centrifugo publish

Example Result:

json
{
  "ok": true,
  "duration_seconds": 1800
}

Messaging Tools

send_message

Send a message to another active agent or broadcast to all agents on the project. Routes through the PHP REST API to ensure consistent database writes, validation, and Centrifugo publishing.

Parameters:

ParameterTypeRequiredDescription
tostringYesRecipient agent name or broadcast
contentstringYesMessage content
typestringNoMessage type: text, status, request (default: text)
project_slugstringNoProject slug (falls back to GXV_PROJECT_SLUG)
session_tokenstringNoSession token (falls back to GXV_SESSION_TOKEN)

I/O: HTTP POST to {PHP_API_URL}/messages

Example Result:

json
{
  "sent": true,
  "id": 156
}

get_messages

Query message history for the project. Reads directly from SQLite for fast access.

Parameters:

ParameterTypeRequiredDescription
senderstringNoFilter by sender agent name
sincestringNoISO timestamp -- only messages after this time
limitintegerNoMax messages (default: 20, range: 1-100)
project_slugstringNoProject slug (falls back to GXV_PROJECT_SLUG)

I/O: Direct SQLite read

Example Result:

json
{
  "messages": [
    {
      "id": 156,
      "from": "agent-swift-42",
      "to": "all",
      "type": "text",
      "content": "Starting work on auth module",
      "at": "2026-02-15T10:30:00"
    },
    {
      "id": 155,
      "from": "agent-keen-7",
      "to": "agent-swift-42",
      "type": "request",
      "content": "Which files are you modifying?",
      "at": "2026-02-15T10:25:00"
    }
  ],
  "count": 2
}

Task Tools

list_tasks

List tasks for the project with optional filters. Reads directly from SQLite. Results are ordered by priority (critical first) then creation date.

Parameters:

ParameterTypeRequiredDescription
statusstringNoFilter: pending, assigned, in_progress, blocked, completed, failed, cancelled
assigned_tostringNoFilter by assigned agent name
prioritystringNoFilter: low, medium, high, critical
limitintegerNoMax tasks (default: 20, range: 1-50)
project_slugstringNoProject slug (falls back to GXV_PROJECT_SLUG)

I/O: Direct SQLite read

Example Result:

json
{
  "tasks": [
    {
      "id": 10,
      "title": "Implement JWT authentication",
      "status": "pending",
      "priority": "high",
      "area": "backend",
      "assigned": null
    },
    {
      "id": 11,
      "title": "Add rate limiting",
      "status": "in_progress",
      "priority": "medium",
      "area": "backend",
      "assigned": "agent-keen-7"
    }
  ],
  "count": 2
}

claim_task

Claim an available pending task. Uses optimistic locking at the database level -- if two agents try to claim the same task simultaneously, exactly one succeeds and the other gets an error.

Parameters:

ParameterTypeRequiredDescription
task_idintegerYesID of the task to claim
project_slugstringNoProject slug (falls back to GXV_PROJECT_SLUG)
session_tokenstringNoSession token (falls back to GXV_SESSION_TOKEN)

I/O: HTTP POST to {PHP_API_URL}/tasks/claim

Example Result:

json
{
  "claimed": true,
  "task": {
    "id": 10,
    "title": "Implement JWT authentication",
    "description": "Add JWT-based authentication to API endpoints...",
    "priority": "high",
    "area": "backend",
    "work_area_paths": ["src/auth/", "src/middleware/"]
  }
}

Failure (already claimed):

json
{
  "error": "Task is no longer available"
}

update_task

Update the status of a task you are assigned to. Use for transitioning to in_progress, blocked, or failed. For completion, use complete_task instead.

Parameters:

ParameterTypeRequiredDescription
task_idintegerYesID of the task to update
statusstringYesNew status: in_progress, blocked, or failed
reasonstringNoReason for the transition (recommended for blocked and failed)
session_tokenstringNoSession token (falls back to GXV_SESSION_TOKEN)

I/O: HTTP POST to {PHP_API_URL}/tasks/{id}/status

Example Result:

json
{
  "updated": true,
  "task": {
    "id": 10,
    "title": "Implement JWT authentication",
    "status": "in_progress"
  }
}

complete_task

Mark a task as completed with a result summary. If the task is linked to a GitHub issue, the summary is automatically posted as a comment on the issue.

Parameters:

ParameterTypeRequiredDescription
task_idintegerYesID of the task to complete
result_summarystringYesSummary of what was accomplished
files_changedstring[]NoFiles created or modified
session_tokenstringNoSession token (falls back to GXV_SESSION_TOKEN)

I/O: HTTP POST to {PHP_API_URL}/tasks/{id}/status with status: "completed"

Example Result:

json
{
  "completed": true,
  "task": {
    "id": 10,
    "title": "Implement JWT authentication"
  }
}

Query Tools

These read-only tools provide additional project introspection capabilities.

activity_log

Search the activity log for a project. Supports filtering by event type and agent name.

Parameters:

ParameterTypeRequiredDescription
project_slugstringYesProject slug
event_typestringNoFilter: checkin, checkout, scope_change, heartbeat, etc.
agent_namestringNoFilter by agent name
limitintegerNoMax results (default: 50, max: 200)
offsetintegerNoPagination offset (default: 0)

I/O: Direct SQLite read

sessions

List agent sessions for a project with optional status filter.

Parameters:

ParameterTypeRequiredDescription
project_slugstringYesProject slug
statusstringNoFilter: active, checked_out, timed_out
limitintegerNoMax results (default: 50, max: 200)
offsetintegerNoPagination offset (default: 0)

I/O: Direct SQLite read

project_info

Get full project details including work areas, configuration, and active agent count.

Parameters:

ParameterTypeRequiredDescription
project_slugstringYesProject slug

I/O: Direct SQLite read

Example Result:

json
{
  "project": {
    "id": 1,
    "name": "My App",
    "slug": "my-app",
    "description": "Main application",
    "repo_url": "/home/user/my-app",
    "conflict_mode": "warn",
    "heartbeat_interval_seconds": 60,
    "heartbeat_ttl_seconds": 180
  },
  "work_areas": [
    {
      "id": 1,
      "name": "Backend",
      "slug": "backend",
      "file_patterns": ["app/**", "plugins/**"],
      "description": "Backend PHP code"
    }
  ],
  "active_agent_count": 2
}

Tool Summary

ToolCategoryI/O PathAuth Required
checkinCoordinationSQLite + CentrifugoNo (creates session)
heartbeatCoordinationSQLitesession_token
presenceCoordinationSQLite readNo
conflict_checkCoordinationSQLite readNo
scope_updateCoordinationSQLite + Centrifugosession_token
checkoutCoordinationSQLite + Centrifugosession_token
send_messageMessagingHTTP POST (PHP API)API key + session_token
get_messagesMessagingSQLite readproject_slug
list_tasksTasksSQLite readproject_slug
claim_taskTasksHTTP POST (PHP API)API key + session_token
update_taskTasksHTTP POST (PHP API)API key + session_token
complete_taskTasksHTTP POST (PHP API)API key + session_token
activity_logQuerySQLite readproject_slug
sessionsQuerySQLite readproject_slug
project_infoQuerySQLite readproject_slug

See Also

GolemXV Documentation