# retoor <retoor@molodetz.nl>

from __future__ import annotations

from .spec import Action, Param

CHUNK_ACTIONS: tuple[Action, ...] = (
    Action(
        name="read_more",
        method="LOCAL",
        path="",
        summary="Read the next part of a previously truncated tool result",
        description=(
            "When any tool result is truncated it includes a chunk_id, total_chars, "
            "remaining_chars, and next_offset. Call read_more with that chunk_id and offset to "
            "page through the rest until remaining_chars is 0, so you can read the whole content."
        ),
        handler="chunks",
        requires_auth=False,
        read_only=True,
        params=(
            Param(
                name="chunk_id",
                location="body",
                description="The chunk_id from a truncated result.",
                required=True,
            ),
            Param(
                name="offset",
                location="body",
                description="Character offset to read from (use next_offset from the prior part).",
                type="integer",
            ),
            Param(
                name="length",
                location="body",
                description="Optional number of characters to return (capped to the response limit).",
                type="integer",
            ),
        ),
    ),
)
