mcp

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultWorkspace = "mcp-agents"
	ServerName       = "termtile"
	ServerVersion    = "1.0.0"
)

Variables

This section is empty.

Functions

func CleanStaleOutput added in v1.1.0

func CleanStaleOutput(workspace string, slot int) error

CleanStaleOutput removes only the output.json artifact file from a workspace+slot directory, preserving context.md and checkpoint.json which may have been placed by the orchestrator for the next spawn.

func CleanupArtifact added in v1.1.0

func CleanupArtifact(workspace string, slot int) error

CleanupArtifact removes the workspace+slot artifact directory and its contents. It is safe to call even if the directory does not exist.

func EnsureArtifactDir added in v1.1.0

func EnsureArtifactDir(workspace string, slot int) (string, error)

EnsureArtifactDir creates the artifact directory for workspace+slot with 0755 permissions. Returns the directory path on success.

func GetArtifactDir added in v1.1.0

func GetArtifactDir(workspace string, slot int) (string, error)

GetArtifactDir returns the filesystem directory for workspace+slot artifacts: {base}/artifacts/{workspace}/{slot}.

func ReadAgentMeta added in v1.1.0

func ReadAgentMeta(workspace string, slot int) (string, error)

ReadAgentMeta reads the agent type from the artifact directory. Exported so the hook CLI (cmd/termtile) can use it.

func ReadArtifact added in v1.1.0

func ReadArtifact(workspace string, slot int) ([]byte, error)

ReadArtifact reads output.json from the workspace+slot artifact directory.

Types

type AgentInfo

type AgentInfo struct {
	Slot           int    `json:"slot"`
	AgentType      string `json:"agent_type"`
	SessionName    string `json:"session_name"`
	CurrentCommand string `json:"current_command"`
	IsIdle         bool   `json:"is_idle"`
	Exists         bool   `json:"exists"`
	SpawnMode      string `json:"spawn_mode"`
}

AgentInfo describes a single running agent.

type GetArtifactArgs

type GetArtifactArgs struct {
	Slot      int    `json:"slot" jsonschema:"required,Slot index to fetch artifact from"`
	Workspace string `` /* 149-byte string literal not displayed */
	// SourceWorkspace is an optional request-scoped hint used when workspace is omitted.
	SourceWorkspace string `` /* 131-byte string literal not displayed */
}

GetArtifactArgs is the input for the get_artifact tool.

type GetArtifactOutput

type GetArtifactOutput struct {
	Workspace      string    `json:"workspace"`
	Slot           int       `json:"slot"`
	Output         string    `json:"output"`
	Truncated      bool      `json:"truncated"`
	Warning        string    `json:"warning,omitempty"`
	OriginalBytes  int       `json:"original_bytes"`
	StoredBytes    int       `json:"stored_bytes"`
	LastUpdatedUTC time.Time `json:"last_updated_utc"`
}

GetArtifactOutput is the output for the get_artifact tool.

type KillAgentInput

type KillAgentInput struct {
	Slot      int    `json:"slot" jsonschema:"required,Slot index of agent to kill"`
	Workspace string `` /* 149-byte string literal not displayed */
	// SourceWorkspace is an optional request-scoped hint used when workspace is omitted.
	SourceWorkspace string `` /* 131-byte string literal not displayed */
}

KillAgentInput is the input for the kill_agent tool.

type KillAgentOutput

type KillAgentOutput struct {
	SessionName string `json:"session_name"`
	Killed      bool   `json:"killed"`
}

KillAgentOutput is the output for the kill_agent tool.

type ListAgentsInput

type ListAgentsInput struct {
	Workspace string `` /* 149-byte string literal not displayed */
	// SourceWorkspace is an optional request-scoped hint used when workspace is omitted.
	SourceWorkspace string `` /* 131-byte string literal not displayed */
}

ListAgentsInput is the input for the list_agents tool.

type ListAgentsOutput

type ListAgentsOutput struct {
	Workspace string      `json:"workspace"`
	Agents    []AgentInfo `json:"agents"`
}

ListAgentsOutput is the output for the list_agents tool.

type MoveTerminalInput

type MoveTerminalInput struct {
	Slot      int    `json:"slot" jsonschema:"required,Slot index of the terminal to move"`
	Workspace string `json:"workspace,omitempty" jsonschema:"Source workspace name (default: active workspace on current desktop)"`
	// SourceWorkspace is an optional request-scoped hint used when workspace is omitted.
	SourceWorkspace string `` /* 131-byte string literal not displayed */
	TargetWorkspace string `json:"target_workspace" jsonschema:"required,Destination workspace name"`
}

MoveTerminalInput is the input for the move_terminal tool.

type MoveTerminalOutput

type MoveTerminalOutput struct {
	SourceWorkspace string `json:"source_workspace"`
	TargetWorkspace string `json:"target_workspace"`
	SourceSlot      int    `json:"source_slot"`
	TargetSlot      int    `json:"target_slot"`
	SessionName     string `json:"session_name"`
	Moved           bool   `json:"moved"`
}

MoveTerminalOutput is the output for the move_terminal tool.

type ReadFromAgentInput

type ReadFromAgentInput struct {
	Slot      int    `json:"slot" jsonschema:"required,Slot index to read from"`
	Lines     int    `json:"lines,omitempty" jsonschema:"Number of lines to capture (default: 50, max: 100)"`
	Clean     bool   `json:"clean,omitempty" jsonschema:"When true, strip TUI chrome and control characters from output (default: false)"`
	SinceLast bool   `` /* 161-byte string literal not displayed */
	Workspace string `` /* 149-byte string literal not displayed */
	// SourceWorkspace is an optional request-scoped hint used when workspace is omitted.
	SourceWorkspace string `` /* 131-byte string literal not displayed */
	Pattern         string `json:"pattern,omitempty" jsonschema:"Optional text pattern to wait for. When set, polls until pattern appears or timeout."`
	Timeout         int    `` /* 127-byte string literal not displayed */
}

ReadFromAgentInput is the input for the read_from_agent tool.

type ReadFromAgentOutput

type ReadFromAgentOutput struct {
	Output      string `json:"output"`
	SessionName string `json:"session_name"`
	Found       *bool  `json:"found,omitempty"`
}

ReadFromAgentOutput is the output for the read_from_agent tool.

type SendToAgentInput

type SendToAgentInput struct {
	Slot      int    `json:"slot" jsonschema:"required,Slot index of the target agent"`
	Text      string `json:"text" jsonschema:"required,Text to send to the agent"`
	Workspace string `` /* 149-byte string literal not displayed */
	// SourceWorkspace is an optional request-scoped hint used when workspace is omitted.
	SourceWorkspace string `` /* 131-byte string literal not displayed */
}

SendToAgentInput is the input for the send_to_agent tool.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the MCP server for termtile agent orchestration.

func NewServer

func NewServer(cfg *config.Config) (*Server, error)

NewServer creates a new MCP server backed by tmux.

func (*Server) Close

func (s *Server) Close() error

Close releases server resources.

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run starts the MCP server on stdio transport, blocking until done.

type SpawnAgentInput

type SpawnAgentInput struct {
	AgentType string `json:"agent_type" jsonschema:"required,The agent type from config (e.g. claude, codex, aider)"`
	Workspace string `` /* 162-byte string literal not displayed */
	// SourceWorkspace is an optional request-scoped hint used when workspace is omitted.
	SourceWorkspace string  `` /* 131-byte string literal not displayed */
	Cwd             string  `json:"cwd,omitempty" jsonschema:"Working directory for the agent"`
	Task            string  `` /* 249-byte string literal not displayed */
	Model           *string `` /* 149-byte string literal not displayed */
	Window          *bool   `` /* 157-byte string literal not displayed */
	DependsOn       []int   `` /* 174-byte string literal not displayed */
	// DependsOnTimeout is only used when DependsOn is set.
	// Value is seconds; default is 300.
	DependsOnTimeout int `` /* 161-byte string literal not displayed */
}

SpawnAgentInput is the input for the spawn_agent tool.

type SpawnAgentOutput

type SpawnAgentOutput struct {
	Slot        int    `json:"slot"`
	SessionName string `json:"session_name"`
	AgentType   string `json:"agent_type"`
	Workspace   string `json:"workspace"`
	SpawnMode   string `json:"spawn_mode"`
}

SpawnAgentOutput is the output for the spawn_agent tool.

type WaitForIdleInput

type WaitForIdleInput struct {
	Slot      int    `json:"slot" jsonschema:"required,Slot index to monitor"`
	Timeout   int    `json:"timeout,omitempty" jsonschema:"Timeout in seconds (default: 120)"`
	Lines     int    `json:"lines,omitempty" jsonschema:"Number of lines to capture when idle (default: 100)"`
	Workspace string `` /* 149-byte string literal not displayed */
	// SourceWorkspace is an optional request-scoped hint used when workspace is omitted.
	SourceWorkspace string `` /* 131-byte string literal not displayed */
}

WaitForIdleInput is the input for the wait_for_idle tool.

type WaitForIdleOutput

type WaitForIdleOutput struct {
	IsIdle      bool   `json:"is_idle"`
	Output      string `json:"output"`
	SessionName string `json:"session_name"`
}

WaitForIdleOutput is the output for the wait_for_idle tool.

Jump to

Keyboard shortcuts

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