# Class ClaudeResponseParser

Parser for Claude CLI JSON output. Implements defensive parsing - only requires essential fields.

#### Implements

- ICliResponseParser<ClaudeCliResponse>

- Defined in packages/nexus-agents/src/cli-adapters/parsers/claude-parser.ts:52

##### Index

### Constructors

constructor

### Properties

name
supportedVersionRange

### Methods

parse
extractResponse
extractUsage
extractSessionId

## Constructors

### constructor

- new ClaudeResponseParser(): ClaudeResponseParser

  #### Returns ClaudeResponseParser

## Properties

### `Readonly` name

name: "claude-parser" = 'claude-parser'

Parser name (for logging)

Implementation of ICliResponseParser.name

- Defined in packages/nexus-agents/src/cli-adapters/parsers/claude-parser.ts:53

### `Readonly` supportedVersionRange

supportedVersionRange: ">=2.0.0 <3.0.0" = '>=2.0.0 <3.0.0'

Supported version range (semver)

Implementation of ICliResponseParser.supportedVersionRange

- Defined in packages/nexus-agents/src/cli-adapters/parsers/claude-parser.ts:54

## Methods

### parse

- parse(raw: string): ClaudeCliResponse | null

  Parses complete Claude CLI response.

  #### Parameters

  - raw: string

  #### Returns ClaudeCliResponse | null

  Implementation of ICliResponseParser.parse

  - Defined in packages/nexus-agents/src/cli-adapters/parsers/claude-parser.ts:59

### extractResponse

- extractResponse(raw: string): string | null

  Extracts just the response text (most stable field). Returns null if the response contains an error.

  #### Parameters

  - raw: string

  #### Returns string | null

  Implementation of ICliResponseParser.extractResponse

  - Defined in packages/nexus-agents/src/cli-adapters/parsers/claude-parser.ts:78

### extractUsage

- extractUsage(raw: string): CliTokenUsage | null

  Extracts token usage from response.

  #### Parameters

  - raw: string

  #### Returns CliTokenUsage | null

  Implementation of ICliResponseParser.extractUsage

  - Defined in packages/nexus-agents/src/cli-adapters/parsers/claude-parser.ts:104

### extractSessionId

- extractSessionId(raw: string): string | null

  Extracts session ID for resumption.

  #### Parameters

  - raw: string

  #### Returns string | null

  Implementation of ICliResponseParser.extractSessionId

  - Defined in packages/nexus-agents/src/cli-adapters/parsers/claude-parser.ts:137