# Class GeminiResponseParser

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

#### Implements

- ICliResponseParser<GeminiCliResponse>

- Defined in packages/nexus-agents/src/cli-adapters/parsers/gemini-parser.ts:51

##### Index

### Constructors

constructor

### Properties

name
supportedVersionRange

### Methods

parse
extractResponse
extractUsage
extractSessionId

## Constructors

### constructor

- new GeminiResponseParser(): GeminiResponseParser

  #### Returns GeminiResponseParser

## Properties

### `Readonly` name

name: "gemini-parser" = 'gemini-parser'

Parser name (for logging)

Implementation of ICliResponseParser.name

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

### `Readonly` supportedVersionRange

supportedVersionRange: ">=0.20.0 <1.0.0" = '>=0.20.0 <1.0.0'

Supported version range (semver)

Implementation of ICliResponseParser.supportedVersionRange

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

## Methods

### parse

- parse(raw: string): GeminiCliResponse | null

  Parses complete Gemini CLI response.

  #### Parameters

  - raw: string

  #### Returns GeminiCliResponse | null

  Implementation of ICliResponseParser.parse

  - Defined in packages/nexus-agents/src/cli-adapters/parsers/gemini-parser.ts:58

### extractResponse

- extractResponse(raw: string): string | null

  Extracts just the response text (most stable field).

  #### Parameters

  - raw: string

  #### Returns string | null

  Implementation of ICliResponseParser.extractResponse

  - Defined in packages/nexus-agents/src/cli-adapters/parsers/gemini-parser.ts:76

### extractUsage

- extractUsage(raw: string): CliTokenUsage | null

  Extracts token usage from response. Gemini has per-model stats, we aggregate them.

  #### Parameters

  - raw: string

  #### Returns CliTokenUsage | null

  Implementation of ICliResponseParser.extractUsage

  - Defined in packages/nexus-agents/src/cli-adapters/parsers/gemini-parser.ts:98

### 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/gemini-parser.ts:156