```ts
function contentBlockFromData(data): ContentBlock;
```

Defined in: [src/types/messages.ts:974](https://github.com/strands-agents/harness-sdk/blob/ca4c20fea3f7d62c29b021c85f336eba5937012f/strands-ts/src/types/messages.ts#L974)

Converts ContentBlockData to a ContentBlock instance. Handles all content block types including text, tool use/result, reasoning, cache points, guard content, and media blocks.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `data` | [`ContentBlockData`](/pr-cms-4024/docs/api/typescript/ContentBlockData/index.md) | The content block data to convert |

## Returns

[`ContentBlock`](/pr-cms-4024/docs/api/typescript/ContentBlock/index.md)

A ContentBlock instance of the appropriate type

## Throws

Error if the content block type is unknown