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

Defined in: [src/types/messages.ts:972](https://github.com/strands-agents/harness-sdk/blob/e4284b561624d906e361535ef1f1adcd5ce3461b/strands-ts/src/types/messages.ts#L972)

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-3457/docs/api/typescript/ContentBlockData/index.md) | The content block data to convert |

## Returns

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

A ContentBlock instance of the appropriate type

## Throws

Error if the content block type is unknown