tools

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BashToolName            = "bash"
	EditToolName            = "edit_file"
	WriteToolName           = "write_file"
	MultiEditToolName       = "multi_edit"
	ApplyPatchToolName      = "apply_patch"
	ViewToolName            = "read_file"
	RemoveFileToolName      = "remove_file"
	CreateDirectoryToolName = "create_directory"
	GetFileMetadataToolName = "get_file_metadata"
	DownloadToolName        = "download"
	FetchToolName           = "fetch"
	AgenticFetchToolName    = "agentic_fetch"
	LSToolName              = "list_directory"
	JobOutputToolName       = "job_output"
	JobKillToolName         = "job_kill"
	GlobToolName            = "glob"
	GrepToolName            = "grep"
	SourcegraphToolName     = "sourcegraph"
	WebFetchToolName        = "web_fetch"
	WebSearchToolName       = "web_search"
	AgentToolName           = "agent"
	AskUserToolName         = "ask_user_question"
	NotebookEditToolName    = "notebook_edit"
	NotebookCreateToolName  = "notebook_create"
	NotebookWriteToolName   = "notebook_write"

	BashNoOutput = "<no output>"
)

Tool name constants matching SDK builtin names where applicable. These are used by the permission dialog and chat UI to render tool-specific UI.

View Source
const (
	// SessionIDContextKey is the key for the session ID in the context.
	SessionIDContextKey sessionIDContextKey = "session_id"
	// MessageIDContextKey is the key for the message ID in the context.
	MessageIDContextKey messageIDContextKey = "message_id"
	// SupportsImagesContextKey is the key for the model's image support capability.
	SupportsImagesContextKey supportsImagesKey = "supports_images"
	// ModelNameContextKey is the key for the model name in the context.
	ModelNameContextKey modelNameKey = "model_name"
)
View Source
const DiagnosticsToolName = "lsp_diagnostics"
View Source
const LSPRestartToolName = "lsp_restart"
View Source
const ReferencesToolName = "lsp_references"
View Source
const SeshatInfoToolName = "seshat_info"
View Source
const SeshatLogsToolName = "seshat_logs"
View Source
const ViewResourceSkill = "skill"

ViewResourceSkill is the resource type for skill-backed file views.

Variables

This section is empty.

Functions

func GetMessageFromContext

func GetMessageFromContext(ctx context.Context) string

GetMessageFromContext retrieves the message ID from the context.

func GetModelNameFromContext

func GetModelNameFromContext(ctx context.Context) string

GetModelNameFromContext retrieves the model name from the context.

func GetSessionFromContext

func GetSessionFromContext(ctx context.Context) string

GetSessionFromContext retrieves the session ID from the context.

func GetSupportsImagesFromContext

func GetSupportsImagesFromContext(ctx context.Context) bool

GetSupportsImagesFromContext retrieves whether the model supports images from the context.

func NewDiagnosticsTool

func NewDiagnosticsTool(lspManager *lsp.Manager) tool.Tool

func NewLSPRestartTool

func NewLSPRestartTool(lspManager *lsp.Manager) tool.Tool

func NewReferencesTool

func NewReferencesTool(lspManager *lsp.Manager) tool.Tool

func NewSeshatInfoTool

func NewSeshatInfoTool(
	cfg *config.ConfigStore,
	lspManager *lsp.Manager,
	allSkills []*skills.Skill,
	activeSkills []*skills.Skill,
	skillTracker *skills.Tracker,
) tool.Tool

func NewSeshatLogsTool

func NewSeshatLogsTool(logFile string) tool.Tool

func ResetCache

func ResetCache()

ResetCache clears any tool-level in-memory caches (e.g. file content, image caches).

Types

type AgentParams

type AgentParams struct {
	Prompt string `json:"prompt" description:"The task for the agent to perform"`
}

AgentParams holds the input for an agent tool call.

type AgenticFetchParams

type AgenticFetchParams struct {
	URL    string `json:"url,omitempty"`
	Prompt string `json:"prompt"`
}

AgenticFetchParams holds the tool input for an agentic_fetch call.

type AgenticFetchPermissionsParams

type AgenticFetchPermissionsParams struct {
	URL    string
	Prompt string
}

AgenticFetchPermissionsParams holds the params for an agentic_fetch permission request.

type ApplyPatchParams

type ApplyPatchParams struct {
	Patch string `json:"patch"`
}

ApplyPatchParams holds the input for an apply_patch tool call.

type AskUserOption

type AskUserOption struct {
	Label       string `json:"label"`
	Value       string `json:"value"`
	Description string `json:"description,omitempty"`
	Preview     string `json:"preview,omitempty"`
}

AskUserOption mirrors an option in an ask_user_question prompt.

type AskUserQuestion

type AskUserQuestion struct {
	Question    string          `json:"question"`
	Header      string          `json:"header"`
	Options     []AskUserOption `json:"options"`
	MultiSelect bool            `json:"multiSelect,omitempty"`
}

AskUserQuestion mirrors one question in an ask_user_question survey.

type AskUserRequest

type AskUserRequest struct {
	ID           string            `json:"id"`
	ToolCallID   string            `json:"tool_call_id"`
	Question     string            `json:"question"`
	Header       string            `json:"header"`
	Options      []AskUserOption   `json:"options"`
	MultiSelect  bool              `json:"multi_select"`
	Questions    []AskUserQuestion `json:"questions,omitempty"`
	IsCustomText bool              `json:"is_custom_text"`
}

AskUserRequest is published to the askUserBroker for each question set the agent asks.

type BashParams

type BashParams struct {
	Command         string `json:"command"`
	RunInBackground bool   `json:"run_in_background,omitempty"`
}

BashParams holds the input for a bash tool call.

type BashPermissionsParams

type BashPermissionsParams struct {
	Command     string
	Description string
}

BashPermissionsParams holds the params for a bash tool permission request.

type BashResponseMetadata

type BashResponseMetadata struct {
	Background  bool   `json:"background,omitempty"`
	Description string `json:"description,omitempty"`
	ShellID     string `json:"shell_id,omitempty"`
	Output      string `json:"output,omitempty"`
}

BashResponseMetadata holds the metadata returned by a bash tool call.

type CreateDirectoryParams

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

CreateDirectoryParams holds the input for a create_directory tool call.

type DiagnosticsParams

type DiagnosticsParams struct {
	FilePath string `json:"file_path,omitempty" description:"The path to the file to get diagnostics for (leave empty for project diagnostics)"`
}

type DownloadParams

type DownloadParams struct {
	URL      string `json:"url"`
	FilePath string `json:"file_path,omitempty"`
	Timeout  int    `json:"timeout,omitempty"`
}

DownloadParams holds the input for a download tool call.

type DownloadPermissionsParams

type DownloadPermissionsParams struct {
	URL      string
	FilePath string
	Timeout  int
}

DownloadPermissionsParams holds the params for a download permission request.

type EditParams

type EditParams struct {
	FilePath string `json:"file_path"`
}

EditParams holds the input for an edit_file tool call.

type EditPermissionsParams

type EditPermissionsParams struct {
	FilePath   string
	OldContent string
	NewContent string
}

EditPermissionsParams holds the params for an edit_file permission request.

type EditResponseMetadata

type EditResponseMetadata struct {
	OldContent string `json:"old_content,omitempty"`
	NewContent string `json:"new_content,omitempty"`
}

EditResponseMetadata holds the metadata returned by an edit_file tool call.

type FetchParams

type FetchParams struct {
	URL     string `json:"url"`
	Format  string `json:"format,omitempty"`
	Timeout int    `json:"timeout,omitempty"`
}

FetchParams holds the input for a fetch tool call.

type FetchPermissionsParams

type FetchPermissionsParams struct {
	URL string
}

FetchPermissionsParams holds the params for a web_fetch permission request.

type GetFileMetadataParams

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

GetFileMetadataParams holds the input for a get_file_metadata tool call.

type GlobParams

type GlobParams struct {
	Pattern string `json:"pattern"`
	Path    string `json:"path,omitempty"`
}

GlobParams holds the input for a glob tool call.

type GrepParams

type GrepParams struct {
	Pattern     string `json:"pattern"`
	Path        string `json:"path,omitempty"`
	Include     string `json:"include,omitempty"`
	LiteralText bool   `json:"literal_text,omitempty"`
}

GrepParams holds the input for a grep tool call.

type JobKillParams

type JobKillParams struct {
	ShellID string `json:"shell_id"`
}

JobKillParams holds the input for a job_kill tool call.

type JobKillResponseMetadata

type JobKillResponseMetadata struct {
	Description string `json:"description,omitempty"`
	Command     string `json:"command,omitempty"`
}

JobKillResponseMetadata holds the metadata returned by a job_kill tool call.

type JobOutputParams

type JobOutputParams struct {
	ShellID string `json:"shell_id"`
}

JobOutputParams holds the input for a job_output tool call.

type JobOutputResponseMetadata

type JobOutputResponseMetadata struct {
	Description string `json:"description,omitempty"`
	Command     string `json:"command,omitempty"`
}

JobOutputResponseMetadata holds the metadata returned by a job_output tool call.

type LSPRestartParams

type LSPRestartParams struct {
	// Name is the optional name of a specific LSP client to restart.
	// If empty, all LSP clients will be restarted.
	Name string `json:"name,omitempty"`
}

type LSParams

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

LSParams holds the input for a list_directory tool call.

type LSPermissionsParams

type LSPermissionsParams struct {
	Path   string
	Ignore []string
}

LSPermissionsParams holds the params for a list_directory permission request.

type MultiEditParams

type MultiEditParams struct {
	FilePath string `json:"file_path"`
	Edits    []any  `json:"edits,omitempty"`
}

MultiEditParams holds the input for a multi_edit tool call.

type MultiEditPermissionsParams

type MultiEditPermissionsParams struct {
	FilePath   string
	OldContent string
	NewContent string
}

MultiEditPermissionsParams holds the params for a multi_edit permission request.

type MultiEditResponseMetadata

type MultiEditResponseMetadata struct {
	OldContent   string `json:"old_content,omitempty"`
	NewContent   string `json:"new_content,omitempty"`
	EditsFailed  []any  `json:"edits_failed,omitempty"`
	EditsApplied int    `json:"edits_applied,omitempty"`
}

MultiEditResponseMetadata holds the metadata returned by a multi_edit tool call.

type NotebookCellPreview

type NotebookCellPreview struct {
	CellType string
	Source   string
}

NotebookCellPreview is a lightweight notebook cell payload for permission previews.

type NotebookCreatePermissionsParams

type NotebookCreatePermissionsParams struct {
	NotebookPath string
	Kernel       string
	Language     string
	CellCount    int
	Cells        []NotebookCellPreview
}

NotebookCreatePermissionsParams holds the params for a notebook_create permission request.

type NotebookEditPermissionsParams

type NotebookEditPermissionsParams struct {
	NotebookPath string
	CellID       string
	CellType     string
	EditMode     string
	OldContent   string // full notebook JSON before edit (may be empty if file is new)
	NewSource    string // the new_source being written into the cell
}

NotebookEditPermissionsParams holds the params for a notebook_edit permission request.

type NotebookWritePermissionsParams

type NotebookWritePermissionsParams struct {
	NotebookPath string
	Kernel       string
	Language     string
	CellCount    int
	Cells        []NotebookCellPreview
	OldContent   string // existing file content when overwriting
}

NotebookWritePermissionsParams holds the params for a notebook_write permission request.

type ReferencesParams

type ReferencesParams struct {
	Symbol string `json:"symbol" description:"The symbol name to search for (e.g., function name, variable name, type name)"`
	Path   string `` /* 161-byte string literal not displayed */
}

type RemoveFileParams

type RemoveFileParams struct {
	Path      string `json:"path"`
	Recursive bool   `json:"recursive,omitempty"`
}

RemoveFileParams holds the input for a remove_file tool call.

type SeshatInfoParams

type SeshatInfoParams struct{}

type SeshatLogsParams

type SeshatLogsParams struct {
	Lines int `json:"lines,omitempty" description:"Number of recent log entries to return (default 50, max 100)"`
}

type SourcegraphParams

type SourcegraphParams struct {
	Query         string `json:"query"`
	Count         int    `json:"count,omitempty"`
	ContextWindow int    `json:"context_window,omitempty"`
}

SourcegraphParams holds the input for a sourcegraph tool call.

type ViewParams

type ViewParams struct {
	FilePath string `json:"file_path"`
	Limit    int    `json:"limit,omitempty"`
	Offset   int    `json:"offset,omitempty"`
}

ViewParams holds the input for a read_file tool call.

type ViewPermissionsParams

type ViewPermissionsParams struct {
	FilePath string
	Offset   int
	Limit    int
}

ViewPermissionsParams holds the params for a read_file permission request.

type ViewResponseMetadata

type ViewResponseMetadata struct {
	Content             string `json:"content,omitempty"`
	FilePath            string `json:"file_path,omitempty"`
	ResourceType        string `json:"resource_type,omitempty"`
	ResourceName        string `json:"resource_name,omitempty"`
	ResourceDescription string `json:"resource_description,omitempty"`
}

ViewResponseMetadata holds the metadata returned by a read_file tool call.

type WebFetchParams

type WebFetchParams struct {
	URL        string `json:"url"`
	Prompt     string `json:"prompt,omitempty"`
	RenderMode string `json:"render_mode,omitempty"`
}

WebFetchParams holds the input for a web_fetch tool call.

type WebSearchParams

type WebSearchParams struct {
	Query string `json:"query"`
}

WebSearchParams holds the input for a web_search tool call.

type WriteParams

type WriteParams struct {
	FilePath string `json:"file_path"`
	Content  string `json:"content"`
}

WriteParams holds the input for a write_file tool call.

type WritePermissionsParams

type WritePermissionsParams struct {
	FilePath   string
	OldContent string
	NewContent string
}

WritePermissionsParams holds the params for a write_file permission request.

type WriteResponseMetadata

type WriteResponseMetadata struct {
	Diff string `json:"diff,omitempty"`
}

WriteResponseMetadata holds the metadata returned by a write_file tool call.

Directories

Path Synopsis
Package mcp provides functionality for managing Model Context Protocol (MCP) clients within the Seshat application.
Package mcp provides functionality for managing Model Context Protocol (MCP) clients within the Seshat application.

Jump to

Keyboard shortcuts

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