tools

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractField

func ExtractField(output, prefix string) string

func HumanSize

func HumanSize(bytes int64) string

func LogToolCall

func LogToolCall(
	ctx context.Context,
	tool string,
	dur time.Duration,
	errs int,
)

func ParseProcessField

func ParseProcessField(s string) string

func RegisterResources

func RegisterResources(server *mcp.Server)

func RegisterTools

func RegisterTools(server *mcp.Server)

func ShellQuote

func ShellQuote(s string) string

func SplitHostPort

func SplitHostPort(s string) (string, string, bool)

func WithToolTimeout

func WithToolTimeout(
	ctx context.Context,
	name string,
	fallback time.Duration,
) (context.Context, context.CancelFunc)

Types

type AvailableUpdate

type AvailableUpdate struct {
	Name    string `json:"name"`
	Current string `json:"current,omitempty"`
	New     string `json:"new,omitempty"`
}

type BusDevice added in v0.1.5

type BusDevice struct {
	Bus    string `json:"bus"`
	Slot   string `json:"slot,omitempty"`
	Class  string `json:"class,omitempty"`
	Vendor string `json:"vendor,omitempty"`
	Device string `json:"device"`
}

type CPUDetails

type CPUDetails struct {
	ModelName string  `json:"model_name"`
	CoreCount int32   `json:"core_count"`
	MHz       float64 `json:"mhz"`
}

type CPUInfoOutput

type CPUInfoOutput struct {
	UsagePercent      float64      `json:"usage_percent"`
	PhysicalCoreCount int32        `json:"physical_core_count"`
	Cores             []CPUDetails `json:"cores"`
	Errors            []string     `json:"errors,omitempty"`
}

func GatherCPUInfo

func GatherCPUInfo(ctx context.Context) (CPUInfoOutput, error)

type CPUTemperatureOutput

type CPUTemperatureOutput struct {
	Temperatures []TemperatureStat `json:"temperatures"`
	Message      string            `json:"message,omitempty"`
	Errors       []string          `json:"errors,omitempty"`
}

func GatherCPUTemperature

func GatherCPUTemperature(ctx context.Context) (CPUTemperatureOutput, error)

type CheckUpdatesInput

type CheckUpdatesInput struct{}

type CheckUpdatesOutput

type CheckUpdatesOutput struct {
	Updates []AvailableUpdate `json:"updates"`
	Total   int               `json:"total"`
	Errors  []string          `json:"errors,omitempty"`
}

func GatherCheckUpdates

func GatherCheckUpdates(ctx context.Context) (CheckUpdatesOutput, error)

type CronJob added in v0.1.8

type CronJob struct {
	Schedule string `json:"schedule"`
	Command  string `json:"command"`
}

type DesktopSessionOutput added in v0.1.8

type DesktopSessionOutput struct {
	SessionType    string   `json:"session_type"`
	CurrentDesktop string   `json:"current_desktop"`
	RuntimeDir     string   `json:"runtime_dir"`
	Display        string   `json:"display"`
	WaylandDisplay string   `json:"wayland_display"`
	Errors         []string `json:"errors,omitempty"`
}

func GatherDesktopSessionInfo added in v0.1.8

func GatherDesktopSessionInfo(
	ctx context.Context,
) (DesktopSessionOutput, error)

func HandleGetDesktopSessionInfo added in v0.1.8

type DiskInfoOutput

type DiskInfoOutput struct {
	Partitions []DiskUsageStat `json:"partitions"`
	Errors     []string        `json:"errors,omitempty"`
}

func GatherDiskInfo

func GatherDiskInfo(
	ctx context.Context,
	mountPoint string,
) (DiskInfoOutput, error)

type DiskUsageStat

type DiskUsageStat struct {
	MountPoint  string  `json:"mount_point"`
	Filesystem  string  `json:"filesystem"`
	Device      string  `json:"device"`
	Total       uint64  `json:"total"`
	Used        uint64  `json:"used"`
	Free        uint64  `json:"free"`
	UsedPercent float64 `json:"used_percent"`
}

type DockerContainer

type DockerContainer struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Image  string `json:"image"`
	Status string `json:"status"`
}

func ListDockerContainers

func ListDockerContainers(ctx context.Context) ([]DockerContainer, error)

type DockerContainerDetail

type DockerContainerDetail struct {
	ID      string                 `json:"id"`
	Name    string                 `json:"name"`
	Image   string                 `json:"image"`
	Created string                 `json:"created"`
	State   map[string]any         `json:"state"`
	Status  string                 `json:"status"`
	Path    string                 `json:"path"`
	Args    []string               `json:"args"`
	Env     []string               `json:"env"`
	Mounts  []DockerContainerMount `json:"mounts"`
	Network map[string]any         `json:"network"`
	Ports   map[string]any         `json:"ports"`
}

type DockerContainerDetailOutput

type DockerContainerDetailOutput struct {
	Container DockerContainerDetail `json:"container"`
	Errors    []string              `json:"errors,omitempty"`
}

func GatherContainerDetail

func GatherContainerDetail(
	ctx context.Context,
	containerID string,
) (DockerContainerDetailOutput, error)

type DockerContainerDiffOutput

type DockerContainerDiffOutput struct {
	Changes []DockerFileChange `json:"changes"`
	Errors  []string           `json:"errors,omitempty"`
}

func GatherContainerDiff

func GatherContainerDiff(
	ctx context.Context,
	containerID string,
) (DockerContainerDiffOutput, error)

type DockerContainerLogsOutput

type DockerContainerLogsOutput struct {
	Logs   []string `json:"logs"`
	Errors []string `json:"errors,omitempty"`
}

func GatherContainerLogs

func GatherContainerLogs(
	ctx context.Context,
	containerID string,
	tail int,
	timestamps bool,
) (DockerContainerLogsOutput, error)

type DockerContainerMount

type DockerContainerMount struct {
	Type        string `json:"type"`
	Source      string `json:"source"`
	Destination string `json:"destination"`
	Mode        string `json:"mode"`
	RW          bool   `json:"rw"`
}

type DockerContainerStatEntry added in v0.2.0

type DockerContainerStatEntry struct {
	ID            string                       `json:"id"`
	Name          string                       `json:"name"`
	CPUPercent    float64                      `json:"cpu_percent"`
	MemoryUsage   uint64                       `json:"memory_usage"`
	MemoryLimit   uint64                       `json:"memory_limit"`
	MemoryPercent float64                      `json:"memory_percent"`
	PIDs          uint64                       `json:"pids"`
	Network       map[string]map[string]uint64 `json:"network,omitempty"`
	BlockRead     uint64                       `json:"block_read"`
	BlockWrite    uint64                       `json:"block_write"`
	Error         string                       `json:"error,omitempty"`
}

type DockerContainerStats

type DockerContainerStats struct {
	CPUPercent    float64                      `json:"cpu_percent"`
	MemoryUsage   uint64                       `json:"memory_usage"`
	MemoryLimit   uint64                       `json:"memory_limit"`
	MemoryPercent float64                      `json:"memory_percent"`
	PIDs          uint64                       `json:"pids"`
	Network       map[string]map[string]uint64 `json:"network,omitempty"`
	BlockRead     uint64                       `json:"block_read"`
	BlockWrite    uint64                       `json:"block_write"`
}

type DockerContainerStatsOutput

type DockerContainerStatsOutput struct {
	Containers []DockerContainerStatEntry `json:"containers"`
	Errors     []string                   `json:"errors,omitempty"`
}

func GatherContainerStats

func GatherContainerStats(
	ctx context.Context,
	containerID string,
) (DockerContainerStatsOutput, error)

type DockerContainerTopOutput

type DockerContainerTopOutput struct {
	Titles    []string   `json:"titles"`
	Processes [][]string `json:"processes"`
	Errors    []string   `json:"errors,omitempty"`
}

func GatherContainerTop

func GatherContainerTop(
	ctx context.Context,
	containerID string,
	args []string,
) (DockerContainerTopOutput, error)

type DockerDiskUsageCategory

type DockerDiskUsageCategory struct {
	ActiveCount int64  `json:"active_count"`
	TotalCount  int64  `json:"total_count"`
	Reclaimable string `json:"reclaimable"`
	TotalSize   string `json:"total_size"`
}

type DockerDiskUsageOutput

type DockerDiskUsageOutput struct {
	Containers DockerDiskUsageCategory `json:"containers"`
	Images     DockerDiskUsageCategory `json:"images"`
	Volumes    DockerDiskUsageCategory `json:"volumes"`
	BuildCache DockerDiskUsageCategory `json:"build_cache"`
	Errors     []string                `json:"errors,omitempty"`
}

func GatherDockerDiskUsage

func GatherDockerDiskUsage(ctx context.Context) (DockerDiskUsageOutput, error)

type DockerFileChange

type DockerFileChange struct {
	Kind string `json:"kind"`
	Path string `json:"path"`
}

type DockerImage

type DockerImage struct {
	Repository string `json:"repository"`
	Tag        string `json:"tag"`
	ID         string `json:"id"`
	Size       string `json:"size"`
}

func ListDockerImages

func ListDockerImages(ctx context.Context) ([]DockerImage, error)

type DockerImageDetail

type DockerImageDetail struct {
	ID           string            `json:"id"`
	RepoTags     []string          `json:"repo_tags"`
	RepoDigests  []string          `json:"repo_digests"`
	Created      string            `json:"created"`
	Author       string            `json:"author"`
	Architecture string            `json:"architecture"`
	OS           string            `json:"os"`
	Size         string            `json:"size"`
	Entrypoint   []string          `json:"entrypoint,omitempty"`
	Cmd          []string          `json:"cmd,omitempty"`
	Env          []string          `json:"env,omitempty"`
	WorkingDir   string            `json:"working_dir,omitempty"`
	Labels       map[string]string `json:"labels,omitempty"`
	Layers       []string          `json:"layers,omitempty"`
}

type DockerImageDetailOutput

type DockerImageDetailOutput struct {
	Image  DockerImageDetail `json:"image"`
	Errors []string          `json:"errors,omitempty"`
}

func GatherImageDetail

func GatherImageDetail(
	ctx context.Context,
	imageID string,
) (DockerImageDetailOutput, error)

type DockerImageHistoryOutput

type DockerImageHistoryOutput struct {
	Layers []DockerImageLayer `json:"layers"`
	Errors []string           `json:"errors,omitempty"`
}

func GatherImageHistory

func GatherImageHistory(
	ctx context.Context,
	imageID string,
) (DockerImageHistoryOutput, error)

type DockerImageLayer

type DockerImageLayer struct {
	ID        string   `json:"id"`
	Created   int64    `json:"created"`
	CreatedBy string   `json:"created_by"`
	Size      string   `json:"size"`
	Tags      []string `json:"tags,omitempty"`
	Comment   string   `json:"comment,omitempty"`
}

type DockerInfoOutput

type DockerInfoOutput struct {
	Containers []DockerContainer `json:"containers"`
	Images     []DockerImage     `json:"images"`
	Errors     []string          `json:"errors,omitempty"`
}

func GatherDockerInfo

func GatherDockerInfo(ctx context.Context) (DockerInfoOutput, error)

type DockerNetworkSummary

type DockerNetworkSummary struct {
	ID         string            `json:"id"`
	Name       string            `json:"name"`
	Driver     string            `json:"driver"`
	Scope      string            `json:"scope"`
	Attachable bool              `json:"attachable"`
	Internal   bool              `json:"internal"`
	Ingress    bool              `json:"ingress"`
	IPv6       bool              `json:"ipv6"`
	Labels     map[string]string `json:"labels,omitempty"`
}

type DockerNetworksOutput

type DockerNetworksOutput struct {
	Networks []DockerNetworkSummary `json:"networks"`
	Errors   []string               `json:"errors,omitempty"`
}

func GatherDockerNetworks

func GatherDockerNetworks(ctx context.Context) (DockerNetworksOutput, error)

type DockerStatsAllOutput added in v0.2.0

type DockerStatsAllOutput struct {
	Containers []DockerContainerStatEntry `json:"containers"`
	Errors     []string                   `json:"errors,omitempty"`
}

func GatherDockerStatsAll added in v0.2.0

func GatherDockerStatsAll(
	ctx context.Context,
	containers []string,
) (DockerStatsAllOutput, error)

func HandleGetDockerStatsAll added in v0.2.0

func HandleGetDockerStatsAll(
	ctx context.Context,
	req *mcp.CallToolRequest,
	input GetDockerStatsAllInput,
) (*mcp.CallToolResult, DockerStatsAllOutput, error)

type DockerSystemInfoOutput

type DockerSystemInfoOutput struct {
	Info   DockerSystemInfoSummary `json:"info"`
	Errors []string                `json:"errors,omitempty"`
}

func GatherDockerSystemInfo

func GatherDockerSystemInfo(
	ctx context.Context,
) (DockerSystemInfoOutput, error)

type DockerSystemInfoSummary

type DockerSystemInfoSummary struct {
	ID                string         `json:"id"`
	ServerVersion     string         `json:"server_version"`
	Architecture      string         `json:"architecture"`
	OSType            string         `json:"os_type"`
	OperatingSystem   string         `json:"operating_system"`
	KernelVersion     string         `json:"kernel_version"`
	NCPU              int            `json:"ncpu"`
	MemTotal          string         `json:"mem_total"`
	Driver            string         `json:"driver"`
	LoggingDriver     string         `json:"logging_driver"`
	CgroupDriver      string         `json:"cgroup_driver"`
	CgroupVersion     string         `json:"cgroup_version"`
	DefaultRuntime    string         `json:"default_runtime"`
	Runtimes          []string       `json:"runtimes,omitempty"`
	ContainersTotal   int            `json:"containers_total"`
	ContainersRunning int            `json:"containers_running"`
	ContainersPaused  int            `json:"containers_paused"`
	ContainersStopped int            `json:"containers_stopped"`
	ImagesTotal       int            `json:"images_total"`
	DockerRootDir     string         `json:"docker_root_dir"`
	SecurityOptions   []string       `json:"security_options,omitempty"`
	Swarm             map[string]any `json:"swarm,omitempty"`
}

type DockerSystemSnapshotOutput added in v0.2.0

type DockerSystemSnapshotOutput struct {
	Info      DockerInfoOutput      `json:"info"`
	Stats     DockerStatsAllOutput  `json:"stats"`
	DiskUsage DockerDiskUsageOutput `json:"disk_usage"`
	Errors    ErrList               `json:"errors,omitempty"`
}

type DockerVolumeSummary

type DockerVolumeSummary struct {
	Name       string            `json:"name"`
	Driver     string            `json:"driver"`
	Mountpoint string            `json:"mountpoint"`
	Scope      string            `json:"scope"`
	CreatedAt  string            `json:"created_at"`
	Size       string            `json:"size,omitempty"`
	Labels     map[string]string `json:"labels,omitempty"`
}

type DockerVolumesOutput

type DockerVolumesOutput struct {
	Volumes []DockerVolumeSummary `json:"volumes"`
	Errors  []string              `json:"errors,omitempty"`
}

func GatherDockerVolumes

func GatherDockerVolumes(ctx context.Context) (DockerVolumesOutput, error)

type EnvironmentVariable added in v0.1.5

type EnvironmentVariable struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type EnvironmentVariablesOutput added in v0.1.5

type EnvironmentVariablesOutput struct {
	Variables []EnvironmentVariable `json:"variables"`
	Count     int                   `json:"count"`
	Errors    []string              `json:"errors,omitempty"`
}

func GatherEnvironmentVariables added in v0.1.5

func GatherEnvironmentVariables(
	ctx context.Context,
	search string,
) (EnvironmentVariablesOutput, error)

func HandleGetEnvironmentVariables added in v0.1.5

type ErrList

type ErrList []string

ErrList collects errors during graceful degradation.

func (*ErrList) Add

func (e *ErrList) Add(context string, err error)

func (ErrList) Err

func (e ErrList) Err() error

type FailedLoginEntry

type FailedLoginEntry struct {
	Username  string `json:"username"`
	Terminal  string `json:"terminal"`
	Source    string `json:"source"`
	Timestamp string `json:"timestamp"`
}

func ParseJournalctlFailedLogins

func ParseJournalctlFailedLogins(output string) []FailedLoginEntry

func ParseLastbOutput

func ParseLastbOutput(output string) []FailedLoginEntry

type FailedLoginsOutput

type FailedLoginsOutput struct {
	Entries []FailedLoginEntry `json:"entries"`
	Errors  []string           `json:"errors,omitempty"`
}

func GatherFailedLogins

func GatherFailedLogins(
	ctx context.Context, lines int,
) (FailedLoginsOutput, error)

func GatherFailedLoginsJournalctl

func GatherFailedLoginsJournalctl(
	ctx context.Context, lines int,
) (FailedLoginsOutput, error)

type GPUDevice

type GPUDevice struct {
	Index         int     `json:"index"`
	Name          string  `json:"name"`
	UsagePercent  float64 `json:"usage_percent"`
	MemoryUsedMB  int64   `json:"memory_used_mb"`
	MemoryTotalMB int64   `json:"memory_total_mb"`
	TemperatureC  int64   `json:"temperature_c"`
	PowerDrawW    float64 `json:"power_draw_w"`
}

type GPUInfoOutput

type GPUInfoOutput struct {
	Vendor string      `json:"vendor"`
	GPUs   []GPUDevice `json:"gpus"`
	Errors []string    `json:"errors,omitempty"`
}

func GatherAMDGPU

func GatherAMDGPU(ctx context.Context) (GPUInfoOutput, error)

func GatherGPUInfo

func GatherGPUInfo(ctx context.Context) (GPUInfoOutput, error)

func GatherNvidiaGPU

func GatherNvidiaGPU(ctx context.Context) (GPUInfoOutput, error)

type GetCPUInfoInput

type GetCPUInfoInput struct{}

type GetCPUTemperatureInput

type GetCPUTemperatureInput struct{}

type GetDesktopSessionInfoInput added in v0.1.8

type GetDesktopSessionInfoInput struct{}

type GetDiskInfoInput

type GetDiskInfoInput struct {
	MountPoint string `json:"mount_point" jsonschema:"optional mount point filter"`
}

type GetDockerContainerDetailInput

type GetDockerContainerDetailInput struct {
	ContainerID string `json:"container_id" jsonschema:"container name or ID"`
}

type GetDockerContainerDiffInput

type GetDockerContainerDiffInput struct {
	ContainerID string `json:"container_id" jsonschema:"container name or ID"`
}

type GetDockerContainerLogsInput

type GetDockerContainerLogsInput struct {
	ContainerID string `json:"container_id"         jsonschema:"container name or ID"`
	Tail        int    `json:"tail,omitempty"       jsonschema:"number of lines to tail (default: 100, max: 10000)"`
	Timestamps  bool   `json:"timestamps,omitempty" jsonschema:"include timestamps (default: false)"`
}

type GetDockerContainerStatsInput

type GetDockerContainerStatsInput struct {
	ContainerIDs string `json:"container_ids" jsonschema:"container name(s) or ID(s), comma-separated, or 'all' for all running containers"`
}

type GetDockerContainerTopInput

type GetDockerContainerTopInput struct {
	ContainerID string   `json:"container_id"   jsonschema:"container name or ID"`
	Args        []string `json:"args,omitempty" jsonschema:"optional arguments to ps (e.g. aux)"`
}

type GetDockerDiskUsageInput

type GetDockerDiskUsageInput struct{}

type GetDockerImageDetailInput

type GetDockerImageDetailInput struct {
	ImageID string `json:"image_id" jsonschema:"image name or ID"`
}

type GetDockerImageHistoryInput

type GetDockerImageHistoryInput struct {
	ImageID string `json:"image_id" jsonschema:"image name or ID"`
}

type GetDockerInfoInput

type GetDockerInfoInput struct{}

type GetDockerNetworksInput

type GetDockerNetworksInput struct{}

type GetDockerStatsAllInput added in v0.2.0

type GetDockerStatsAllInput struct {
	Containers []string `json:"containers,omitempty" jsonschema:"optional list of container names or IDs to filter"`
}

type GetDockerSystemInfoInput

type GetDockerSystemInfoInput struct{}

type GetDockerSystemSnapshotInput added in v0.2.0

type GetDockerSystemSnapshotInput struct{}

type GetDockerVolumesInput

type GetDockerVolumesInput struct{}

type GetEnvironmentVariablesInput added in v0.1.5

type GetEnvironmentVariablesInput struct {
	Search string `json:"search,omitempty" jsonschema:"optional search string to filter by name (matches prefix or substring, case-insensitive)"`
}

type GetFailedLoginsInput

type GetFailedLoginsInput struct {
	Lines int `json:"lines,omitempty" jsonschema:"number of recent entries (default: 20)"`
}

type GetGPUInfoInput

type GetGPUInfoInput struct{}

type GetHardwareBusInfoInput added in v0.1.5

type GetHardwareBusInfoInput struct {
	Search string `json:"search,omitempty" jsonschema:"optional search string to filter devices by any field (bus, slot, class, vendor, device)"`
}

type GetInodeUsageInput

type GetInodeUsageInput struct {
	MountPoint string `json:"mount_point,omitempty" jsonschema:"optional mount point filter"`
}

type GetInstalledPackagesInput

type GetInstalledPackagesInput struct {
	Name string `json:"name,omitempty" jsonschema:"optional package name filter"`
}

type GetJournalLogsInput

type GetJournalLogsInput struct {
	Unit     string `json:"unit,omitempty"     jsonschema:"optional systemd unit name (e.g. 'nginx.service')"`
	Priority string `json:"priority,omitempty" jsonschema:"optional log priority: emerg,alert,crit,err,warning,notice,info,debug"`
	Since    string `json:"since,omitempty"    jsonschema:"optional start time (e.g. '1 hour ago', '2024-07-03')"`
	Until    string `json:"until,omitempty"    jsonschema:"optional end time"`
	Lines    int    `json:"lines,omitempty"    jsonschema:"number of recent lines (default: 50)"`
	User     bool   `json:"user,omitempty"     jsonschema:"query user-level journal (default: false)"`
}

type GetLargestFilesInput

type GetLargestFilesInput struct {
	Path  string `json:"path,omitempty"  jsonschema:"directory to scan (default: current dir)"`
	Limit int    `json:"limit,omitempty" jsonschema:"max results (default: 10, max: 100)"`
}

type GetListeningPortsInput

type GetListeningPortsInput struct {
	Protocol string `json:"protocol,omitempty" jsonschema:"optional protocol filter: tcp, udp"`
}

type GetLoadAverageInput

type GetLoadAverageInput struct{}

type GetLoggedInUsersInput

type GetLoggedInUsersInput struct{}

type GetManPageInput added in v0.1.2

type GetManPageInput struct {
	Command           string `json:"command"                       jsonschema:"command name to get the man page for"`
	MaxLines          int    `json:"max_lines,omitempty"           jsonschema:"maximum number of lines to return (default: 500, max: 10000)"`
	CleanSpecialChars bool   `json:"clean_special_chars,omitempty" jsonschema:"clean backspace formatting characters (default: true)"`
	Search            string `json:"search,omitempty"              jsonschema:"search term to grep for in the man page (case-insensitive)"`
	ContextLines      int    `` /* 137-byte string literal not displayed */
	Offset            int    `json:"offset,omitempty"              jsonschema:"line offset to start reading from (0-based)"`
}

type GetMemoryInfoInput

type GetMemoryInfoInput struct{}

type GetMountOptionsInput

type GetMountOptionsInput struct {
	MountPoint string `json:"mount_point,omitempty" jsonschema:"optional mount point filter (e.g. '/')"`
}

type GetNetworkInfoInput

type GetNetworkInfoInput struct{}

type GetProcessInfoInput

type GetProcessInfoInput struct {
	SortBy string `json:"sort_by" jsonschema:"sort by 'cpu' or 'memory' (default: cpu)"`
	Limit  int    `json:"limit"   jsonschema:"max results (default: 10, max: 100)"`
}

type GetServiceStatusInput

type GetServiceStatusInput struct {
	Name string `json:"name"           jsonschema:"service name (e.g. 'nginx.service' or 'sshd')"`
	User bool   `json:"user,omitempty" jsonschema:"query user-level service (default: false)"`
}

type GetSystemInfoInput

type GetSystemInfoInput struct{}

type GetSystemSnapshotInput

type GetSystemSnapshotInput struct{}

type GetSystemdUnitsInput

type GetSystemdUnitsInput struct{}

type GetTopIOProcessesInput

type GetTopIOProcessesInput struct {
	Limit int `json:"limit,omitempty" jsonschema:"max results (default: 10, max: 50)"`
}

type GetUserAutomationInput added in v0.1.8

type GetUserAutomationInput struct{}

type HardwareBusInfoOutput added in v0.1.5

type HardwareBusInfoOutput struct {
	PCIDevices []BusDevice `json:"pci_devices"`
	USBDevices []BusDevice `json:"usb_devices"`
	Errors     []string    `json:"errors,omitempty"`
}

func GatherHardwareBusInfo added in v0.1.5

func GatherHardwareBusInfo(
	ctx context.Context,
	search string,
) (HardwareBusInfoOutput, error)

func HandleGetHardwareBusInfo added in v0.1.5

func HandleGetHardwareBusInfo(
	ctx context.Context,
	req *mcp.CallToolRequest,
	input GetHardwareBusInfoInput,
) (*mcp.CallToolResult, HardwareBusInfoOutput, error)

type IOProcessStat

type IOProcessStat struct {
	Time    string  `json:"time"`
	PID     int     `json:"pid"`
	KbRdS   float64 `json:"kb_rd_s"`
	KbWrS   float64 `json:"kb_wr_s"`
	Command string  `json:"command"`
}

type InodeUsageOutput

type InodeUsageOutput struct {
	Mounts []InodeUsageStat `json:"mounts"`
	Errors []string         `json:"errors,omitempty"`
}

func GatherInodeUsage

func GatherInodeUsage(
	ctx context.Context,
	mountPoint string,
) (InodeUsageOutput, error)

type InodeUsageStat

type InodeUsageStat struct {
	Filesystem  string `json:"filesystem"`
	Inodes      uint64 `json:"inodes"`
	IUsed       uint64 `json:"iused"`
	IFree       uint64 `json:"ifree"`
	IUsePercent string `json:"iuse_percent"`
	MountedOn   string `json:"mounted_on"`
}

type InstalledPackage

type InstalledPackage struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type InstalledPackagesOutput

type InstalledPackagesOutput struct {
	Packages []InstalledPackage `json:"packages"`
	Total    int                `json:"total"`
	Errors   []string           `json:"errors,omitempty"`
}

func GatherInstalledPackages

func GatherInstalledPackages(
	ctx context.Context,
	name string,
) (InstalledPackagesOutput, error)

type InterfaceStats

type InterfaceStats struct {
	Name        string `json:"name"`
	BytesSent   uint64 `json:"bytes_sent"`
	BytesRecv   uint64 `json:"bytes_recv"`
	PacketsSent uint64 `json:"packets_sent"`
	PacketsRecv uint64 `json:"packets_recv"`
	ErrorsIn    uint64 `json:"errors_in"`
	ErrorsOut   uint64 `json:"errors_out"`
	DropsIn     uint64 `json:"drops_in"`
	DropsOut    uint64 `json:"drops_out"`
}

type JournalLogEntry

type JournalLogEntry struct {
	Timestamp string `json:"timestamp"`
	Message   string `json:"message"`
}

type JournalLogsOutput

type JournalLogsOutput struct {
	Entries []JournalLogEntry `json:"entries"`
	Errors  []string          `json:"errors,omitempty"`
}

func GatherJournalLogs

func GatherJournalLogs(
	ctx context.Context, unit, priority, since, until string,
	lines int, user bool,
) (JournalLogsOutput, error)

type LargestFileEntry

type LargestFileEntry struct {
	Name      string `json:"name"`
	SizeBytes int64  `json:"size_bytes"`
	SizeHuman string `json:"size_human"`
	IsDir     bool   `json:"is_dir"`
}

type LargestFilesOutput

type LargestFilesOutput struct {
	Path    string             `json:"path"`
	Entries []LargestFileEntry `json:"entries"`
	Errors  []string           `json:"errors,omitempty"`
}

func GatherLargestFiles

func GatherLargestFiles(
	ctx context.Context,
	path string,
	limit int,
) (LargestFilesOutput, error)

type ListeningPort

type ListeningPort struct {
	Protocol string `json:"protocol"`
	Address  string `json:"address"`
	Port     string `json:"port"`
	Process  string `json:"process,omitempty"`
}

type ListeningPortsOutput

type ListeningPortsOutput struct {
	Ports  []ListeningPort `json:"ports"`
	Errors []string        `json:"errors,omitempty"`
}

func GatherListeningPorts

func GatherListeningPorts(
	ctx context.Context,
	protocol string,
) (ListeningPortsOutput, error)

type LoadAverageOutput

type LoadAverageOutput struct {
	Load1  float64  `json:"load_1"`
	Load5  float64  `json:"load_5"`
	Load15 float64  `json:"load_15"`
	Errors []string `json:"errors,omitempty"`
}

func GatherLoadAverage

func GatherLoadAverage(ctx context.Context) (LoadAverageOutput, error)

type LoggedInUser

type LoggedInUser struct {
	Username  string `json:"username"`
	Terminal  string `json:"terminal"`
	From      string `json:"from"`
	LoginTime string `json:"login_time"`
}

type LoggedInUsersOutput

type LoggedInUsersOutput struct {
	Users  []LoggedInUser `json:"users"`
	Errors []string       `json:"errors,omitempty"`
}

func GatherLoggedInUsers

func GatherLoggedInUsers(ctx context.Context) (LoggedInUsersOutput, error)

type ManPageOutput added in v0.1.2

type ManPageOutput struct {
	Command   string   `json:"command"`
	Content   string   `json:"content"`
	Truncated bool     `json:"truncated,omitempty"`
	Errors    []string `json:"errors,omitempty"`
}

func GatherManPage added in v0.1.2

func GatherManPage(
	ctx context.Context,
	command string,
	maxLines int,
	cleanSpecialChars bool,
	search string,
	contextLines int,
	offset int,
) (ManPageOutput, error)

func HandleGetManPage added in v0.1.2

func HandleGetManPage(
	ctx context.Context,
	_ *mcp.CallToolRequest,
	input GetManPageInput,
) (*mcp.CallToolResult, ManPageOutput, error)

type MemoryInfoOutput

type MemoryInfoOutput struct {
	Total           uint64   `json:"total"`
	Used            uint64   `json:"used"`
	Free            uint64   `json:"free"`
	UsedPercent     float64  `json:"used_percent"`
	SwapTotal       uint64   `json:"swap_total"`
	SwapUsed        uint64   `json:"swap_used"`
	SwapFree        uint64   `json:"swap_free"`
	SwapUsedPercent float64  `json:"swap_used_percent"`
	Errors          []string `json:"errors,omitempty"`
}

func GatherMemoryInfo

func GatherMemoryInfo(ctx context.Context) (MemoryInfoOutput, error)

type MountEntry

type MountEntry struct {
	Source  string   `json:"source"`
	Target  string   `json:"target"`
	FSType  string   `json:"fs_type"`
	Options []string `json:"options"`
}

type MountOptionsOutput

type MountOptionsOutput struct {
	Mounts []MountEntry `json:"mounts"`
	Errors []string     `json:"errors,omitempty"`
}

func GatherMountOptions

func GatherMountOptions(
	ctx context.Context,
	mountPoint string,
) (MountOptionsOutput, error)

type NetworkInfoOutput

type NetworkInfoOutput struct {
	Interfaces []InterfaceStats `json:"interfaces"`
	Errors     []string         `json:"errors,omitempty"`
}

func GatherNetworkInfo

func GatherNetworkInfo(ctx context.Context) (NetworkInfoOutput, error)

type PingHostInput

type PingHostInput struct {
	Host    string `json:"host"              jsonschema:"hostname or IP address to ping"`
	Count   int    `json:"count,omitempty"   jsonschema:"number of packets (default: 4)"`
	Timeout int    `json:"timeout,omitempty" jsonschema:"timeout in seconds (default: 10)"`
}

type PingOutput

type PingOutput struct {
	Host               string   `json:"host"`
	PacketsTransmitted int      `json:"packets_transmitted"`
	PacketsReceived    int      `json:"packets_received"`
	PacketLossPercent  float64  `json:"packet_loss_percent"`
	MinLatencyMs       float64  `json:"min_latency_ms"`
	AvgLatencyMs       float64  `json:"avg_latency_ms"`
	MaxLatencyMs       float64  `json:"max_latency_ms"`
	Errors             []string `json:"errors,omitempty"`
}

func GatherPing

func GatherPing(
	ctx context.Context,
	host string,
	count, timeout int,
) (PingOutput, error)

func HandlePingHost

func HandlePingHost(
	ctx context.Context,
	req *mcp.CallToolRequest,
	input PingHostInput,
) (*mcp.CallToolResult, PingOutput, error)

type ProcessInfoOutput

type ProcessInfoOutput struct {
	Processes []ProcessStat `json:"processes"`
	Errors    []string      `json:"errors,omitempty"`
}

func GatherProcessInfo

func GatherProcessInfo(
	ctx context.Context,
	sortBy string,
	limit int,
) (ProcessInfoOutput, error)

type ProcessStat

type ProcessStat struct {
	PID           int32   `json:"pid"`
	Name          string  `json:"name"`
	CPUPercent    float64 `json:"cpu_percent"`
	MemoryPercent float32 `json:"memory_percent"`
	Status        string  `json:"status"`
}

type ResolveDNSInput

type ResolveDNSInput struct {
	Hostname string `json:"hostname" jsonschema:"hostname to resolve (e.g. 'example.com')"`
}

type ResolveDNSOutput

type ResolveDNSOutput struct {
	Hostname  string   `json:"hostname"`
	Addresses []string `json:"addresses"`
	Errors    []string `json:"errors,omitempty"`
}

func GatherDNSResolve

func GatherDNSResolve(
	ctx context.Context,
	hostname string,
) (ResolveDNSOutput, error)

type ServiceStatusOutput

type ServiceStatusOutput struct {
	Name   string   `json:"name"`
	Loaded string   `json:"loaded,omitempty"`
	Active string   `json:"active,omitempty"`
	PID    string   `json:"pid,omitempty"`
	Output string   `json:"output"`
	Errors []string `json:"errors,omitempty"`
}

func GatherServiceStatus

func GatherServiceStatus(
	ctx context.Context, name string, user bool,
) (ServiceStatusOutput, error)

type SystemInfoOutput

type SystemInfoOutput struct {
	Hostname      string   `json:"hostname"`
	OSName        string   `json:"os_name"`
	OSVersion     string   `json:"os_version"`
	KernelVersion string   `json:"kernel_version"`
	Architecture  string   `json:"architecture"`
	UptimeSeconds uint64   `json:"uptime_seconds"`
	Errors        []string `json:"errors,omitempty"`
}

func GatherSystemInfo

func GatherSystemInfo(ctx context.Context) (SystemInfoOutput, error)

type SystemSnapshotOutput

type SystemSnapshotOutput struct {
	System      SystemInfoOutput     `json:"system"`
	CPU         CPUInfoOutput        `json:"cpu"`
	Temperature CPUTemperatureOutput `json:"temperature"`
	Memory      MemoryInfoOutput     `json:"memory"`
	Disk        DiskInfoOutput       `json:"disk"`
	Network     NetworkInfoOutput    `json:"network"`
	LoadAverage LoadAverageOutput    `json:"load_average"`
	Processes   ProcessInfoOutput    `json:"processes"`
	Docker      DockerInfoOutput     `json:"docker"`
	Errors      ErrList              `json:"errors,omitempty"`
}

type SystemdTimer added in v0.1.8

type SystemdTimer struct {
	Unit      string `json:"unit"`
	Activates string `json:"activates"`
	Next      string `json:"next,omitempty"`
	Last      string `json:"last,omitempty"`
}

type SystemdUnit

type SystemdUnit struct {
	Unit        string `json:"unit"`
	Load        string `json:"load"`
	Active      string `json:"active"`
	Sub         string `json:"sub"`
	Description string `json:"description"`
}

type SystemdUnitsOutput

type SystemdUnitsOutput struct {
	Units  []SystemdUnit `json:"units"`
	Errors []string      `json:"errors,omitempty"`
}

func GatherSystemdUnits

func GatherSystemdUnits(ctx context.Context) (SystemdUnitsOutput, error)

type TemperatureStat

type TemperatureStat struct {
	SensorKey   string  `json:"sensor_key"`
	Temperature float64 `json:"temperature_celsius"`
}

type TopIOProcessesOutput

type TopIOProcessesOutput struct {
	Processes []IOProcessStat `json:"processes"`
	Errors    []string        `json:"errors,omitempty"`
}

func GatherTopIOProcesses

func GatherTopIOProcesses(
	ctx context.Context,
	limit int,
) (TopIOProcessesOutput, error)

type UserAutomationOutput added in v0.1.8

type UserAutomationOutput struct {
	CronJobs      []CronJob      `json:"cron_jobs"`
	SystemdTimers []SystemdTimer `json:"systemd_timers"`
	Errors        []string       `json:"errors,omitempty"`
}

func GatherUserAutomation added in v0.1.8

func GatherUserAutomation(
	ctx context.Context,
) (UserAutomationOutput, error)

func HandleGetUserAutomation added in v0.1.8

Jump to

Keyboard shortcuts

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