# selection.update

Explicitly resolve and pin client settings and save defaults for future clients.

Capability: op_sys_selection_update
Protocol: op-sys.capabilities.v1
Runtime: 0.3.0
Availability: Local configuration + configured shared service
Optional integration: false
Canonical page: /docs/reference/op_sys_selection_update

## Authority

Browser sign-in verifies a user. API keys authorize a scoped service identity. Supply credential references on the runtime host.

## Invocation

CLI, SDK and MCP use the same operation and arguments; where a hosted HTTP binding exists, its route carries the same domain contract. Host paths and environment references refer to the runtime host. Request template: replace placeholder IDs and supply complete contract-specific objects before use. This is not a complete runnable workflow.

### CLI

```sh
op-sys --output json tools call op_sys_selection_update \
  --arguments '{}'
```

### Python SDK

```python
import json
from op_sys import OpSys

client = OpSys()
arguments = json.loads("{}")
result = client.capabilities.call(
    "op_sys_selection_update", arguments
)
print(result)
```

### MCP (initialized connection)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "op_sys_selection_update",
    "arguments": {}
  }
}
```

Named CLI command: op-sys selection update (use --help for flags).

SDK convenience: client.selection.update(…). The capability adapter may wrap the result.

## Parameters

### connection

Optional; string. 

minLength: 1; maxLength: 128

### ledger

Optional; string. Explicit empty string clears this selection; omission uses configured defaults.

minLength: 0; maxLength: 128

### remote

Optional; string. Explicit empty string clears this selection; omission uses configured defaults.

minLength: 0; maxLength: 128

### organization

Optional; string. Compatibility alias for workspace.

minLength: 1; maxLength: 128

### workspace

Optional; string. Workspace ID. Supplied clients default to the selected workspace.

minLength: 1; maxLength: 128

### Complete input schema

```json
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "connection": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "ledger": {
      "type": "string",
      "minLength": 0,
      "maxLength": 128,
      "description": "Explicit empty string clears this selection; omission uses configured defaults."
    },
    "remote": {
      "type": "string",
      "minLength": 0,
      "maxLength": 128,
      "description": "Explicit empty string clears this selection; omission uses configured defaults."
    },
    "organization": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "description": "Compatibility alias for workspace."
    },
    "workspace": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "description": "Workspace ID. Supplied clients default to the selected workspace."
    }
  },
  "required": []
}
```

## Behavior

- Explicitly resolve and pin client settings and save defaults for future clients.
- Required rights: client.context. Effective permissions are checked when called.
- Login and workspace selection set the account context. Publishing and synchronization are separate actions.
- Use the workspace ID returned by discovery and the exact service URL.
- Noninteractive setup returns the next required step; interactive CLI use can compose sign-in and selection.

## Response

Returns Selection. See the result schema for exact fields.

### Complete result JSON Schema

```json
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "connection": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        {
          "type": "null"
        }
      ],
      "description": "Selected hosted connection; null means local use."
    },
    "endpoint": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 2048
        },
        {
          "type": "null"
        }
      ]
    },
    "ledger_id": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        {
          "type": "null"
        }
      ]
    },
    "remote": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        {
          "type": "null"
        }
      ]
    },
    "principal": {
      "anyOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "issuer": {
              "type": "string",
              "minLength": 1,
              "maxLength": 2048
            },
            "subject": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "required": [
            "issuer",
            "subject"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "Verified hosted principal, or null for local use or an unassociated hosted identity. Inspect identity.get for the local principal."
    },
    "organization": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "connection",
    "endpoint",
    "ledger_id",
    "remote",
    "principal"
  ]
}
```


[Runtime output field catalog](/docs/output-contracts.json) (descriptive contracts, not JSON Schema validators).

CLI: use --output json. For tools call, read the operation result at payload.tool.result; payload.tool.name identifies the capability. The outer envelope is {schema_version: "v1", payload: {tool: {name, result}}}.

Python: client.capabilities.call(name, arguments) returns the operation result. SDK exceptions preserve reason and code.

MCP: tools/call returns JSON text and structuredContent. Application failures set isError; inspect reason/code instead of matching message text.

Related resource schemas (not necessarily a complete operation response):
- [ledger-core.v1.schema.json](/docs/schemas/ledger-core.v1.schema.json)

## Errors and recovery

[Ledger limits and operation catalog](/docs/ledger-core.json)

Canonical operation: selection.update

Permissions: client.context

Retry: read_only; concurrency: none

Codes: invalid_input, contract_invalid, payload_invalid, contract_not_admitted, permission_denied, not_found, revision_conflict, operation_conflict, unsupported, authority_unavailable, outcome_uncertain, outcome_expired, validation_context_unavailable, file_unavailable, integrity_failure, ledger_archived, ledger_deleted, resnapshot_required, identity_changed, authority_fenced, withdrawal_requires_resolution, limit_exceeded, rate_limited, payment_required

[HTTP status mappings and schemas](/docs/ledger-core.openapi.json)



Family reasons are representative, not exhaustive.

A timeout is not proof that a write failed. Reuse the documented retry identity, batch, offset or mutation ID. If this operation has no documented retry identity, inspect its state before repeating it.

On authorization failure, correct the configured identity or grants; do not change the local actor to impersonate a hosted principal. On validation failure, correct the input against the published schema and selected contract.

On a revision or state conflict, retrieve current state and reconcile intent. Do not automatically overwrite a competing update. Preserve unknown additive response fields when building consumers.

## Source manuals

- [client-connections](/docs/raw/manuals/client-connections.md)
- [account-administration](/docs/raw/manuals/account-administration.md)
- [team-onboarding](/docs/raw/manuals/team-onboarding.md)
- [public-capabilities](/docs/raw/manuals/public-capabilities.md)
- [command-output-schema](/docs/raw/manuals/command-output-schema.md)
