Skip to main content
Glama
aiterm-mcp
by kitepon

agent_auth

Start, check, or cancel official CLI authentication for supported coding harnesses, show auth URLs and choices, and route responses while each CLI stores credentials.

Instructions

各harnessの公式CLI認証を開始・確認・取消する。CLIごとのコマンドと認証URL/codeの抽出はAitermが所有し、資格情報は各CLIだけが保存する。auth_uiの段階と公式URL・選択肢を表示する。入力はrespondで同じbindingへ送り、pty_send/pty_keyへ認証コードを渡さない。authenticatedは認証の結果であり、agent_launchの起動準備完了とは別。remoteは他toolと同じ標準対応。startは公式の状態が認証済みなら何も起こさずauthenticatedを返す。relogin:trueを付けると、認証済みに見えても公式ログインを開始する(別のアカウントへ入り直す時、ログインの期限切れを状態から見抜けない時)。Aitermは資格情報を消さず、置き換えは公式CLIが行う。Codexの公式ログインは、始めた時点で元のログインを消す(途中でcancelしても戻らない)。Antigravityのreloginは未対応を返す。

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "harness": "<harness>",
      "action": "<action>"
    },
    "name": "agent_auth"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdNo公式CLIを実行する作業ディレクトリの絶対パス
loginNoclaude-code harnessだけ、token_fileと組。startは状態を聞かずに必ず `claude setup-token` を起こし、出たtokenをAitermがtoken_fileへ書く(本人・0600・置き換え)。statusはtoken_fileが本人の0600の空でない通常fileの時だけauthenticated(.credentials.jsonは見ない)。失敗・取消では書かない。receiptはloginを返す
actionYes
remoteNo別端末のAitermで実行する時のSSH接続情報。hostだけならssh_configの接続名として使う。Aitermは接続情報を保存・管理しない。passphraseは会話記録に残るため、ssh-agentかpassphrase_env(環境変数名)を推奨する。
harnessYes
reloginNostartで、公式の状態が認証済みでも公式ログインを開始する。既定false。trueの時、authenticatedかつsession_idがnullの結果は返さない
env_varsNostartで認証PTYへ引き継ぐ環境変数名。値はreceiptへ返さない
responseNo
session_idNo
token_fileNologin:"oauth_token"の書き先。許可したfolder(環境変数AITERM_CLAUDE_TOKEN_ROOTS。未設定なら<HOME>/.aiterm/claude-accounts。0.70.99までは従来の固定の置き場も受ける)の<slot>/oauth-tokenだけを受け、他はAGENT_AUTH_TOKEN_FILE_REJECTED(開始しない)
expected_bindingNo
configuration_rootNoclaude-code harnessだけ。認証する設定root(CLAUDE_CONFIG_DIR)。受ける範囲はagent_launchと同じ。startで決めたrootと違う指定はAGENT_CONFIGURATION_ROOT_REJECTED
expected_prompt_digestNo

Output Schema

NameRequiredDescriptionDefault
urlYes
loginNologin:"oauth_token"で扱った時だけ。無ければ、このAitermはそのmodeを知らない
schemaYes
statusYes
auth_uiNo
harnessYes
messageYes
user_codeYes
session_idYes
account_labelNoclaude-code harnessでauthenticatedの時だけ。公式statusのe-mail(表示用、資格情報ではない)。読めない時はnull
input_requiredYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.70.127
    • changedInput schema / properties / harness / enum
      Previous value: -[
      -  "claude-code",
      -  "claude-machine",
      -  "codex-cli",
      -  "grok-cli",
      -  "cursor-cli",
      -  "antigravity-cli"
      -]New value: +[
      +  "claude-code",
      +  "claude-machine",
      +  "codex-cli",
      +  "codex-machine",
      +  "grok-cli",
      +  "grok-machine",
      +  "cursor-cli",
      +  "cursor-machine",
      +  "antigravity-cli",
      +  "antigravity-machine"
      +]
    • changedOutput schema / properties / harness / enum
      Previous value: -[
      -  "claude-code",
      -  "claude-machine",
      -  "codex-cli",
      -  "grok-cli",
      -  "cursor-cli",
      -  "antigravity-cli"
      -]New value: +[
      +  "claude-code",
      +  "claude-machine",
      +  "codex-cli",
      +  "codex-machine",
      +  "grok-cli",
      +  "grok-machine",
      +  "cursor-cli",
      +  "cursor-machine",
      +  "antigravity-cli",
      +  "antigravity-machine"
      +]
  2. Changed2 schema fields changedv0.70.112
    • addedInput schema / properties / remote / properties / ssh
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Pinned ssh: {known_hosts_file, host_key_alias?, identity_agent | identity_file, strict_host_key?: true} (absolute paths). Strict host checking against that file with that one identity, no user ssh config. Not combinable with identity_file, ssh_options, passphrase or passphrase_env. Needs Aiterm 0.70.101 on the other computer.",
      +  "properties": {
      +    "host_key_alias": {
      +      "pattern": "^(?!-)[A-Za-z0-9._%:\\[\\]-]{1,255}$",
      +      "type": "string"
      +    },
      +    "identity_agent": {
      +      "pattern": "^(\\/|[A-Za-z]:[\\\\/])[^\\s\"'`]*$",
      +      "type": "string"
      +    },
      +    "identity_file": {
      +      "pattern": "^(\\/|[A-Za-z]:[\\\\/])[^\\s\"'`]*$",
      +      "type": "string"
      +    },
      +    "known_hosts_file": {
      +      "pattern": "^(\\/|[A-Za-z]:[\\\\/])[^\\s\"'`]*$",
      +      "type": "string"
      +    },
      +    "strict_host_key": {
      +      "const": true,
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "known_hosts_file"
      +  ],
      +  "type": "object"
      +}
    • changedInput schema / properties / token_file / description
      Previous value: -"login:\"oauth_token\"の書き先。HOME配下の決まった形のslotのoauth-tokenだけを受け、他はAGENT_AUTH_TOKEN_FILE_REJECTED(開始しない)"New value: +"login:\"oauth_token\"の書き先。許可したfolder(環境変数AITERM_CLAUDE_TOKEN_ROOTS。未設定なら<HOME>/.aiterm/claude-accounts。0.70.99までは従来の固定の置き場も受ける)の<slot>/oauth-tokenだけを受け、他はAGENT_AUTH_TOKEN_FILE_REJECTED(開始しない)"
  3. Changed2 schema fields changedv0.70.91
    • changedInput schema / properties / harness / enum
      Previous value: -[
      -  "claude-code",
      -  "codex-cli",
      -  "grok-cli",
      -  "cursor-cli",
      -  "antigravity-cli"
      -]New value: +[
      +  "claude-code",
      +  "claude-machine",
      +  "codex-cli",
      +  "grok-cli",
      +  "cursor-cli",
      +  "antigravity-cli"
      +]
    • changedOutput schema / properties / harness / enum
      Previous value: -[
      -  "claude-code",
      -  "codex-cli",
      -  "grok-cli",
      -  "cursor-cli",
      -  "antigravity-cli"
      -]New value: +[
      +  "claude-code",
      +  "claude-machine",
      +  "codex-cli",
      +  "grok-cli",
      +  "cursor-cli",
      +  "antigravity-cli"
      +]
  4. Changed3 schema fields changedv0.70.39
    • addedInput schema / properties / login
      Added value: +{
      +  "description": "claude-code harnessだけ、token_fileと組。startは状態を聞かずに必ず `claude setup-token` を起こし、出たtokenをAitermがtoken_fileへ書く(本人・0600・置き換え)。statusはtoken_fileが本人の0600の空でない通常fileの時だけauthenticated(.credentials.jsonは見ない)。失敗・取消では書かない。receiptはloginを返す",
      +  "enum": [
      +    "oauth_token"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / token_file
      Added value: +{
      +  "description": "login:\"oauth_token\"の書き先。HOME配下の決まった形のslotのoauth-tokenだけを受け、他はAGENT_AUTH_TOKEN_FILE_REJECTED(開始しない)",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedOutput schema / properties / login
      Added value: +{
      +  "description": "login:\"oauth_token\"で扱った時だけ。無ければ、このAitermはそのmodeを知らない",
      +  "enum": [
      +    "oauth_token"
      +  ],
      +  "type": "string"
      +}
  5. Changed2 schema fields changedv0.70.3
    • addedInput schema / properties / configuration_root
      Added value: +{
      +  "description": "claude-code harnessだけ。認証する設定root(CLAUDE_CONFIG_DIR)。受ける範囲はagent_launchと同じ。startで決めたrootと違う指定はAGENT_CONFIGURATION_ROOT_REJECTED",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedOutput schema / properties / account_label
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "description": "claude-code harnessでauthenticatedの時だけ。公式statusのe-mail(表示用、資格情報ではない)。読めない時はnull"
      +}
  6. Changed2 schema fields changedv0.62.2
    • changedInput schema / properties / harness / enum
      Previous value: -[
      -  "claude-code",
      -  "codex-cli",
      -  "grok-cli",
      -  "cursor-cli"
      -]New value: +[
      +  "claude-code",
      +  "codex-cli",
      +  "grok-cli",
      +  "cursor-cli",
      +  "antigravity-cli"
      +]
    • changedOutput schema / properties / harness / enum
      Previous value: -[
      -  "claude-code",
      -  "codex-cli",
      -  "grok-cli",
      -  "cursor-cli"
      -]New value: +[
      +  "claude-code",
      +  "codex-cli",
      +  "grok-cli",
      +  "cursor-cli",
      +  "antigravity-cli"
      +]
  7. Changed5 schema fields changedv0.61.24
    • changedInput schema / properties / action / enum
      Previous value: -[
      -  "start",
      -  "status",
      -  "cancel"
      -]New value: +[
      +  "start",
      +  "status",
      +  "cancel",
      +  "respond"
      +]
    • addedInput schema / properties / expected_binding
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "launch_id": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "metadata_identity": {
      +      "type": "string"
      +    },
      +    "native_id": {
      +      "type": "string"
      +    },
      +    "pane_id": {
      +      "type": "string"
      +    },
      +    "pane_pid": {
      +      "exclusiveMinimum": 0,
      +      "maximum": 9007199254740991,
      +      "type": "integer"
      +    },
      +    "pane_started": {
      +      "type": "string"
      +    },
      +    "server_pid": {
      +      "exclusiveMinimum": 0,
      +      "maximum": 9007199254740991,
      +      "type": "integer"
      +    },
      +    "server_started": {
      +      "type": "string"
      +    },
      +    "session_id": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "session_id",
      +    "launch_id",
      +    "metadata_identity",
      +    "native_id",
      +    "pane_id",
      +    "server_pid",
      +    "server_started",
      +    "pane_pid",
      +    "pane_started"
      +  ],
      +  "type": "object"
      +}
    • addedInput schema / properties / expected_prompt_digest
      Added value: +{
      +  "pattern": "^[a-f0-9]{64}$",
      +  "type": "string"
      +}
    • addedInput schema / properties / response
      Added value: +{
      +  "oneOf": [
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "kind": {
      +          "const": "authorization_code",
      +          "type": "string"
      +        },
      +        "value": {
      +          "maxLength": 8192,
      +          "minLength": 1,
      +          "pattern": "^[!-~]+$",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "kind",
      +        "value"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "id": {
      +          "pattern": "^option-[1-9]$",
      +          "type": "string"
      +        },
      +        "kind": {
      +          "const": "choice",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "kind",
      +        "id"
      +      ],
      +      "type": "object"
      +    }
      +  ]
      +}
    • addedOutput schema / properties / auth_ui
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "binding": {
      +      "anyOf": [
      +        {
      +          "additionalProperties": false,
      +          "properties": {
      +            "launch_id": {
      +              "anyOf": [
      +                {
      +                  "type": "string"
      +                },
      +                {
      +                  "type": "null"
      +                }
      +              ]
      +            },
      +            "metadata_identity": {
      +              "type": "string"
      +            },
      +            "native_id": {
      +              "type": "string"
      +            },
      +            "pane_id": {
      +              "type": "string"
      +            },
      +            "pane_pid": {
      +              "exclusiveMinimum": 0,
      +              "maximum": 9007199254740991,
      +              "type": "integer"
      +            },
      +            "pane_started": {
      +              "type": "string"
      +            },
      +            "server_pid": {
      +              "exclusiveMinimum": 0,
      +              "maximum": 9007199254740991,
      +              "type": "integer"
      +            },
      +            "server_started": {
      +              "type": "string"
      +            },
      +            "session_id": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "session_id",
      +            "launch_id",
      +            "metadata_identity",
      +            "native_id",
      +            "pane_id",
      +            "server_pid",
      +            "server_started",
      +            "pane_pid",
      +            "pane_started"
      +          ],
      +          "type": "object"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "choices": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "id": {
      +            "type": "string"
      +          },
      +          "label": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "id",
      +          "label"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "input": {
      +      "anyOf": [
      +        {
      +          "enum": [
      +            "authorization_code",
      +            "choice"
      +          ],
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "message": {
      +      "type": "string"
      +    },
      +    "prompt_digest": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "schema": {
      +      "const": "aiterm.auth-ui.v1",
      +      "type": "string"
      +    },
      +    "stage": {
      +      "enum": [
      +        "open_url",
      +        "device_code",
      +        "paste_code",
      +        "select",
      +        "waiting",
      +        "complete",
      +        "failed",
      +        "unavailable"
      +      ],
      +      "type": "string"
      +    },
      +    "title": {
      +      "type": "string"
      +    },
      +    "url": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "user_code": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    }
      +  },
      +  "required": [
      +    "schema",
      +    "stage",
      +    "title",
      +    "message",
      +    "binding",
      +    "url",
      +    "user_code",
      +    "input",
      +    "prompt_digest",
      +    "choices"
      +  ],
      +  "type": "object"
      +}
  8. Changed1 schema field changedv0.60.1
    • addedInput schema / properties / relogin
      Added value: +{
      +  "description": "startで、公式の状態が認証済みでも公式ログインを開始する。既定false。trueの時、authenticatedかつsession_idがnullの結果は返さない",
      +  "type": "boolean"
      +}
  9. Addedv0.46.1

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so thoroughly: credential ownership and non-deletion by Aiterm, Codex's irreversible deletion of the prior login on start (even if cancelled midway), Antigravity's unsupported relogin, and the token_file 0600 write/replace behavior with its rejection error. These are exactly the destructive/auth-sensitive traits an agent needs before calling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and the core respond/pty_send rule are front-loaded, and every sentence carries caveats that matter (Codex deletion, Antigravity limitation). It is dense and mostly unstructured prose, though, with several long conditional clauses that slow scanning for a 13-parameter tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex, stateful auth tool with 13 parameters, nested remote config, and an output schema, the description covers the flow stages, the credential-lifecycle consequences, the per-harness exceptions, and the error path. Return values are covered by the output schema, so nothing material is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 54% across 13 parameters, and the schema already documents relogin, login/token_file, env_vars, configuration_root, and remote. The description reinforces cross-parameter semantics (respond pairing with the same binding, relogin interacting with authenticated/session_id, official-state short-circuit on start) but leaves cwd, expected_binding, expected_prompt_digest, and session_id entirely to the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb set and resource: start, check, and cancel the official CLI authentication for each harness. It immediately scopes ownership (Aiterm owns the per-harness commands and URL/code extraction; credentials are stored only by each CLI), which distinguishes it from generic PTY and launch tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit routing rules: auth input must go through respond to the same binding and must NOT be handed to pty_send/pty_key. It also explains when start is a no-op and when relogin:true is warranted (switching accounts, undetectable expiry), and states that authenticated is distinct from agent_launch readiness.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.