---
title: "McapSchema"
---
<!-- DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/docs/website.rs -->

⚠️ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
A schema definition that describes the structure of messages in an MCAP file.

Schemas define the data types and field structures used by messages in MCAP channels.
They provide the blueprint for interpreting message payloads, specifying field names,
types, and organization. Each schema is referenced by channels to indicate how their
messages should be decoded and understood.

See also [`archetypes.McapChannel`](https://rerun.io/docs/reference/types/archetypes/mcap_channel) for channels that reference these schemas,
[`archetypes.McapMessage`](https://rerun.io/docs/reference/types/archetypes/mcap_message) for the messages that conform to these schemas, and the
[MCAP specification](https://mcap.dev/) for complete format details.

## Fields
### Required
* `id`: [`SchemaId`](https://rerun.io/docs/reference/types/components/schema_id.md)
* `name`: [`Text`](https://rerun.io/docs/reference/types/components/text.md)
* `encoding`: [`Text`](https://rerun.io/docs/reference/types/components/text.md)
* `data`: [`Blob`](https://rerun.io/docs/reference/types/components/blob.md)


## Can be shown in
* [DataframeView](https://rerun.io/docs/reference/types/views/dataframe_view.md)

## API reference links
 * 🌊 [C++ API docs for `McapSchema`](https://ref.rerun.io/docs/cpp/stable/structrerun_1_1archetypes_1_1McapSchema.html)
 * 🐍 [Python API docs for `McapSchema`](https://ref.rerun.io/docs/python/stable/common/archetypes#rerun.archetypes.McapSchema)
 * 🦀 [Rust API docs for `McapSchema`](https://docs.rs/rerun/latest/rerun/archetypes/struct.McapSchema.html)

## Example

### Simple MCAP schema

```python
"""Log a simple MCAP schema definition."""

import rerun as rr

rr.init("rerun_example_mcap_schema", spawn=True)

# Example ROS2 message definition for a simple Point message
point_schema = """float64 x
float64 y
float64 z"""

rr.log(
    "mcap/schemas/geometry_point",
    rr.McapSchema(
        id=42,
        name="geometry_msgs/msg/Point",
        encoding="ros2msg",
        data=point_schema.encode("utf-8"),
    ),
)
```

