Documentation
¶
Overview ¶
Package present provides bounded list and field preview helpers for tool payloads.
Index ¶
- func CapSlice[T any](items []T, limit int) ([]T, summarize.Meta)
- func MapCapList[T, V any](items []T, limit int, mapFn func(*T) V) ([]V, summarize.Meta)
- func PreviewField(text string, limit int) (preview string, truncated bool)
- func SummarizeToolList[T any](data any, meta summarize.Meta, spec summarize.ToolListSummary[T]) (summary string, next []string)
- func ToolListItems[T any](data any) ([]T, bool)
- func ToolListTotal(data any) (int, bool)
- type TextPreview
- type ToolListData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapCapList ¶
MapCapList caps items and maps each element into a presentation view.
func PreviewField ¶
PreviewField returns a bounded text preview.
func SummarizeToolList ¶
func SummarizeToolList[T any](data any, meta summarize.Meta, spec summarize.ToolListSummary[T]) (summary string, next []string)
SummarizeToolList builds envelope summary and next hints from tool result list data.
func ToolListItems ¶
ToolListItems returns typed items from tool result data (structured list or bare slice).
func ToolListTotal ¶
ToolListTotal returns the item total for tool result list data.
Types ¶
type TextPreview ¶
TextPreview holds a bounded text preview for tool result data.
func RedactText ¶
func RedactText(text string, limit int) (preview TextPreview, cleared string)
RedactText returns a preview and the text to expose in tool result data. When truncated, cleared is empty so callers can omit the full field from payloads.
type ToolListData ¶
type ToolListData struct {
Items any `json:"items"`
Count int `json:"count"`
Total int `json:"total,omitempty"`
Truncated bool `json:"truncated,omitempty"`
Hint string `json:"hint,omitempty"`
}
ToolListData is the structured list payload placed in tool result data.
func WrapToolList ¶
WrapToolList caps items and attaches list metadata for tool result data.