toolmeta

package
v0.411.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package toolmeta provides shared tool-call metadata helpers used by both the ACP prompt handler and the WebUI SSE handler. These functions map Pando tool names and their JSON-encoded inputs into display-friendly titles, kinds, statuses, and file locations — without depending on any ACP SDK types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisplayTitle

func DisplayTitle(toolName string, rawInput interface{}, cwd string) string

DisplayTitle returns a human-friendly title for a tool call.

func InputBool

func InputBool(rawInput interface{}, key string) bool

InputBool extracts a boolean value from a raw input map.

func InputInt

func InputInt(rawInput interface{}, key string) int

InputInt extracts an integer value from a raw input map.

func InputString

func InputString(rawInput interface{}, key string) string

InputString extracts a string value from a raw input map.

func IsBashTool

func IsBashTool(name string) bool

IsBashTool returns true for tool names that execute shell commands.

func IsEditTool

func IsEditTool(name string) bool

IsEditTool returns true for tool names that modify files on disk.

func IsTodoWriteTool

func IsTodoWriteTool(name string) bool

IsTodoWriteTool returns true for the TodoWrite tool.

func ParseJSONInput

func ParseJSONInput(s string) interface{}

ParseJSONInput decodes a JSON string into a native map/slice. Returns an empty map if the string is blank or cannot be parsed.

func ToDisplayPath

func ToDisplayPath(path string, cwd string) string

ToDisplayPath makes a path relative to cwd when possible.

Types

type Location

type Location struct {
	Path string `json:"path"`
}

Location represents a file/directory affected by a tool call.

func ToLocations

func ToLocations(toolName, inputJSON string) []Location

ToLocations extracts file/directory locations from a tool call input string.

type ToolCallStatus

type ToolCallStatus string

ToolCallStatus represents the lifecycle state of a tool call.

const (
	StatusPending    ToolCallStatus = "pending"
	StatusInProgress ToolCallStatus = "in_progress"
	StatusCompleted  ToolCallStatus = "completed"
	StatusFailed     ToolCallStatus = "failed"
)

type ToolKind

type ToolKind string

ToolKind categorises a tool call for UI rendering.

const (
	ToolKindExecute    ToolKind = "execute"
	ToolKindEdit       ToolKind = "edit"
	ToolKindRead       ToolKind = "read"
	ToolKindSearch     ToolKind = "search"
	ToolKindFetch      ToolKind = "fetch"
	ToolKindThink      ToolKind = "think"
	ToolKindSwitchMode ToolKind = "switch_mode"
	ToolKindOther      ToolKind = "other"
)

func MapToolKind

func MapToolKind(toolName string) ToolKind

MapToolKind returns the ToolKind for a given Pando tool name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL