Harn ACP/MCP extensions v1

Canonical URL: https://harnlang.com/spec/harn-extensions/v1

This page defines Harn-owned protocol extension fields for clients that consume Harn over Agent Client Protocol (ACP) or Model Context Protocol (MCP). Harn uses _meta.harn for fields that extend an upstream protocol object. Standard ACP and MCP fields stay at their standard locations.

Compatibility

The ACP adapter advertises this contract during initialize:

{
  "agentCapabilities": {
    "_meta": {
      "harn": {
        "schemaCompatibility": "agentclientprotocol/agent-client-protocol schema v0.12.2",
        "extensionContract": "https://harnlang.com/spec/harn-extensions/v1",
        "sessionUpdateExtensions": [
          "fs_watch",
          "handoff",
          "hitl_request",
          "hitl_resolved",
          "log",
          "progress",
          "skill_activated",
          "skill_deactivated",
          "skill_narrow",
          "skill_scope_tools",
          "tool_search_query",
          "tool_search_result",
          "transcript_compacted",
          "worker_update"
        ],
        "toolLifecycleExtensionFields": [
          "audit",
          "durationMs",
          "error",
          "errorCategory",
          "executionDurationMs",
          "executor",
          "parsing",
          "rawInputPartial"
        ],
        "contentExtensionFields": ["visible_delta", "visible_text"],
        "extensionMethods": {
          "_harn/agentEvent": {
            "description": "Pipeline-loop milestones that have no canonical ACP session/update mapping.",
            "schema": "https://harnlang.com/spec/harn-extensions/agent-event/v1"
          },
          "_harn/providerCatalog": {
            "description": "Return the normalized provider/model catalog used by this runtime.",
            "schema": "https://harnlang.com/schemas/provider-catalog.v2.json",
            "schemaVersion": 2
          }
        },
        "hostCapabilityOperations": {
          "process": [
            "exec",
            "list_shells",
            "get_default_shell",
            "set_default_shell",
            "shell_invocation"
          ]
        }
      }
    }
  }
}

Field stability means the field name and location are part of this v1 contract. Consumers must still ignore unknown sibling fields and tolerate missing optional fields.

FieldLocationStabilityMeaning
schemaCompatibilityagentCapabilities._meta.harnStable v1Upstream ACP schema version Harn pins its ACP wire shape against.
extensionContractagentCapabilities._meta.harnStable v1Public spec URL for Harn-owned extension fields.
sessionUpdateExtensionsagentCapabilities._meta.harnStable v1Harn session/update discriminators a client may receive in addition to upstream ACP values.
toolLifecycleExtensionFieldsagentCapabilities._meta.harnStable v1Harn fields that can appear below tool_call._meta.harn or tool_call_update._meta.harn.
contentExtensionFieldsagentCapabilities._meta.harnStable v1Harn fields that can appear below ACP content-block _meta.harn.
extensionMethodsagentCapabilities._meta.harnStable v1Harn-owned JSON-RPC methods beyond canonical ACP methods. Unknown keys must be ignored.
hostCapabilityOperationsagentCapabilities._meta.harnExperimentalHost bridge operation names Harn may request through ACP host calls.

ACP extension methods

_harn/providerCatalog

Request:

{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "_harn/providerCatalog",
  "params": {}
}

Response result is the provider catalog v2 artifact identified by https://harnlang.com/schemas/provider-catalog.v2.json. It is the same shape as harn providers export, with the serving runtime's effective provider and capability overlays already applied.

Clients should use this method for provider/model pickers and avoid maintaining parallel hard-coded provider lists. The catalog includes provider auth requirements and env var names, aliases, context windows, tool-support hints, local/cloud classification, availability, and pricing where known.

ACP session updates

Harn extension session updates keep the sessionUpdate discriminator at params.update.sessionUpdate; all Harn-owned payload fields are under params.update._meta.harn.

{
  "method": "session/update",
  "params": {
    "sessionId": "session_123",
    "update": {
      "sessionUpdate": "progress",
      "_meta": {
        "harn": {
          "phase": "ingest",
          "message": "loading",
          "progress": 3,
          "total": 10
        }
      }
    }
  }
}
sessionUpdate value_meta.harn fieldsStability
progressphase, message, progress, total, dataStable v1
loglevel, message, fieldsStable v1
fs_watchsubscriptionId, eventsStable v1
worker_updateworkerId, workerName, workerTask, workerMode, event, status, terminal, metadata, auditStable v1
transcript_compactedmode, reason, strategy, archivedMessages, estimatedTokensBefore, estimatedTokensAfter, snapshotAssetId, instructionMode, instructionSource, compactionPolicyStable v1
transcript_projectedpolicy, reason, prefixHash, keptCount, droppedCount, providerSafetyBlocked, redactedCount, reclaimedTokens, rootsConsulted, redactionPointersStable v1
handoffhandoffId, artifactId, handoffStable v1
skill_activatedskillName, iteration, reasonStable v1
skill_deactivatedskillName, iterationStable v1
skill_narrowreason, removedTools, remainingTools, policy, removedToolDetails, keptToolDetailsStable v1
skill_scope_toolsskillName, allowedToolsStable v1
tool_search_querytoolUseId, name, query, strategy, modeStable v1
tool_search_resulttoolUseId, promoted, strategy, modeStable v1
hitl_requestrequestId, kind, payloadExperimental
hitl_resolvedrequestId, kind, outcomeExperimental

The audit field on worker_update is the same mutation-session record shape used by tool lifecycle audit.

agent_progress task-list entries are not encoded as the Harn progress extension. ACP adapters emit them as canonical sessionUpdate: "plan" updates with full-replacement entries; message-only agent_progress reports use the Harn progress extension with phase: "narration".

Standard ACP updates such as agent_message_chunk, tool_call, tool_call_update, and plan keep their standard payload fields at the root of params.update.

ACP tool lifecycle

tool_call and tool_call_update use canonical ACP root fields for toolCallId, title, kind, status, rawInput, rawOutput, and content. Harn-owned lifecycle fields appear under params.update._meta.harn.

{
  "sessionUpdate": "tool_call_update",
  "toolCallId": "call_123",
  "title": "edit_file",
  "status": "completed",
  "rawOutput": "ok",
  "_meta": {
    "harn": {
      "executor": "host_bridge",
      "durationMs": 25,
      "executionDurationMs": 18,
      "audit": {
        "session_id": "session_123",
        "run_id": "run_123",
        "mutation_scope": "apply_workspace"
      }
    }
  }
}
FieldApplies toStabilityMeaning
audittool_call, tool_call_updateStable v1Mutation-session record for grouping writes, approvals, undo/redo, and audit logs.
executortool_call_updateStable v1Execution backend: "harn_builtin", "host_bridge", "provider_native", or {"kind":"mcp_server","serverName":"..."}.
durationMstool_call_updateStable v1End-to-end duration from Harn's lifecycle observation.
executionDurationMstool_call_updateStable v1Backend execution duration when Harn can separate it from parsing or routing overhead.
errortool_call_updateStable v1Human-readable execution or validation error.
errorCategorytool_call_updateStable v1Machine-readable error category such as schema_validation or parse_aborted.
parsingtool_call, tool_call_updateExperimentalWhether the event represents an in-progress structured input parsing state.
rawInputPartialtool_call_updateExperimentalUnparseable partial tool input bytes captured during streaming tool-call parsing.

audit is omitted when no mutation session is installed.

ACP content extensions

Harn can add visibility metadata to ACP text content blocks. These fields live under the content block's _meta.harn, not under the surrounding update.

{
  "sessionUpdate": "agent_message_chunk",
  "content": {
    "type": "text",
    "text": "hello",
    "_meta": {
      "harn": {
        "visible_text": "hello",
        "visible_delta": "hello"
      }
    }
  }
}
FieldLocationStabilityMeaning
visible_textcontent._meta.harnExperimentalAssistant-visible text after Harn visibility filtering.
visible_deltacontent._meta.harnExperimentalNewly visible text in this content chunk.

MCP extension boundary

Harn does not currently emit Harn-owned _meta.harn fields on MCP tool annotations, capabilities, or notifications. MCP consumers should treat the following as standard MCP fields, not Harn namespace extensions:

MCP surfaceFields Harn emits or consumesNamespace
Tool list entriesannotations.title, annotations.readOnlyHint, annotations.destructiveHint, annotations.idempotentHint, annotations.openWorldHintMCP standard
Tool list entriesexecution.taskSupportMCP task execution extension
Server capabilitiestools.listChanged, resources.listChanged, prompts.listChanged, logging, tasks, elicitationMCP standard or latest-spec MCP extension
Tool-call requests_meta.progressTokenMCP standard
Notificationsnotifications/progress with progressToken, progress, messageMCP standard
Task correlation metadata_meta["io.modelcontextprotocol/related-task"].taskIdMCP namespace

If Harn introduces MCP-specific Harn metadata in a future revision, those fields will be added below _meta.harn and advertised by a new version of this page.