Documentation
¶
Overview ¶
Package schema provides helpers for building tool input schemas.
Package internal provides shared utilities for tool implementations
Index ¶
- func Array(desc string, itemType string) map[string]any
- func Bool(desc string) map[string]any
- func Integer(desc string) map[string]any
- func Parse[T any](input string) (T, error)
- func Props(required []string, properties map[string]any) anthropic.ToolInputSchemaParam
- func ShouldTruncateOldToolResult(turnsAgo int) bool
- func Str(desc string) map[string]any
- func SummarizeFileWrite(path string, lineCount int) string
- func SummarizeOldToolResult(toolName, fullOutput string) string
- func TruncateFileRead(content string, truncated bool) string
- func TruncateLines(output string, keepFirst, keepLast int) string
- func TruncateList(items []string, maxItems int) string
- func TruncateShellOutput(output string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Props ¶
func Props(required []string, properties map[string]any) anthropic.ToolInputSchemaParam
Props builds an InputSchema from a map of property definitions.
func ShouldTruncateOldToolResult ¶
ShouldTruncateOldToolResult determines if an old tool result should be summarized. turnsAgo: how many turns ago this tool result occurred.
func SummarizeFileWrite ¶
SummarizeFileWrite creates a brief summary for file write operations.
func SummarizeOldToolResult ¶
SummarizeOldToolResult creates a brief summary of an old tool result. This is used when pruning old tool results from conversation history.
func TruncateFileRead ¶
TruncateFileRead truncates file read output for very large files. Files under 2000 lines are returned in full — truncating source files causes repeated re-reads that waste API turns (far more expensive than the extra context tokens). Truncation is for large error logs, content dumps, and generated files — not normal source code. Files over 2000 lines get truncated (first 500 + last 50).
func TruncateLines ¶
TruncateLines smart-truncates multi-line output to keep context manageable. keepFirst: number of lines to keep from the start keepLast: number of lines to keep from the end Returns truncated output with a marker showing how many lines were removed.
func TruncateList ¶
TruncateList truncates a list of items (e.g., file listings). maxItems: maximum number of items to show before truncating.
func TruncateShellOutput ¶
TruncateShellOutput truncates shell command output intelligently. Default: keep first 20 + last 10 lines if over 40 lines total.
Types ¶
This section is empty.