---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/context/thrift/contracts/interfaces/ContentLike.md
description: >-
  A `Tokenizable`-like value: renders to a string and (usually) knows its own
  token cost. Every content field the working set carries (system prompt,
  standing instructions, message/thought content) is either a plain `string` or
  a value shaped like this.
---

# Interface: ContentLike

Defined in: [src/batteries/context/thrift/contracts.ts:85](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/context/thrift/contracts.ts#L85)

A `Tokenizable`-like value: renders to a string and (usually) knows its own token cost. Every
content field the working set carries (system prompt, standing instructions, message/thought
content) is either a plain `string` or a value shaped like this.

## Remarks

`estimateTokens` is optional here (unlike [Estimable](Estimable.md)) because a caller may hand the battery
a plain object that only renders text (e.g. a lightweight test double) — the battery falls back to
measuring `toString()` via the injected [EstimateTokensFn](../type-aliases/EstimateTokensFn.md) when `estimateTokens` is absent.

## Methods

### estimateTokens()?

```ts
optional estimateTokens(encoding: string, ctx?: unknown): number;
```

Defined in: [src/batteries/context/thrift/contracts.ts:89](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/context/thrift/contracts.ts#L89)

Optional self-measurement, preferred over the `toString()` fallback when present.

#### Parameters

| Parameter  | Type      |
| ---------- | --------- |
| `encoding` | `string`  |
| `ctx?`     | `unknown` |

#### Returns

`number`

***

### toString()

```ts
toString(): string;
```

Defined in: [src/batteries/context/thrift/contracts.ts:87](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/context/thrift/contracts.ts#L87)

Render this value to its dispatched text form.

#### Returns

`string`
