prepend_block
Insert content as the first child of a specified parent block to maintain a stable hierarchy. Provide parent_id and data to prepend markdown or DOM blocks without relying on adjacent positions.
Instructions
插入前置子块。
适用场景: - 需要稳定地插入到某个父块下(强父子关系)。 - 例如把列表、段落挂到某个 H2/H3 下。
使用方法: - parent_id 传入目标父块 ID。 - data 为待插入内容,data_type 支持 markdown 或 dom。
注意事项: - 该工具是"父块优先"的安全写入方式,不依赖 next_id/previous_id。 - 若需要基于相邻块精确定位,请使用 insert_block。
与 insert_block 的区别: - prepend_block 强制作为父块的第一个子块,层级关系稳定。 - insert_block 依赖相邻块定位,层级可能因 next_id/previous_id 而变化。
示例(假设现有结构:父块A -> 子块B -> 子块C): # 插入到 A 的开头(作为第一个子块) prepend_block(parent_id="block_a", data="新块") # 结果:A -> 新块 -> B -> C
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | ||
| data_type | No | markdown | |
| parent_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |