server

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: AGPL-3.0-only

SPDX-License-Identifier: AGPL-3.0-only

SPDX-License-Identifier: AGPL-3.0-only

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLogger added in v0.5.4

func CreateLogger(cfg *config.Config) (*logging.Logger, error)

CreateLogger creates a logger appropriate for the given configuration. For stdio transport, it directs output to a log file to avoid corrupting the JSON-RPC stream on stdout.

Types

type AITaskParams

type AITaskParams struct {
	TaskParams
	Prompt string `json:"prompt" description:"prompt for the AI to execute (required for AI tasks)"`
}

AITaskParams combines task parameters with AI-specific parameters

type MCPServer

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

MCPServer represents the MCP scheduler server

func NewMCPServer

func NewMCPServer(cfg *config.Config, scheduler *scheduler.Scheduler, cmdExecutor *command.CommandExecutor, agentExecutor *agent.AgentExecutor, resultStore model.ResultStore, logger *logging.Logger) (*MCPServer, error)

NewMCPServer creates a new MCP scheduler server

func (*MCPServer) Done added in v0.1.2

func (s *MCPServer) Done() <-chan struct{}

Done returns a channel that is closed when the server's transport exits. For stdio mode, this fires when stdin is closed (parent process exited).

func (*MCPServer) Execute

func (s *MCPServer) Execute(ctx context.Context, task *model.Task, timeout time.Duration) error

Execute implements the taskexec.Executor interface by routing tasks to the appropriate executor

func (*MCPServer) GetTaskResult

func (s *MCPServer) GetTaskResult(taskID string) (*model.Result, bool)

GetTaskResult retrieves the latest execution result for a task.

func (*MCPServer) GetTaskResults

func (s *MCPServer) GetTaskResults(taskID string, limit int) ([]*model.Result, error)

GetTaskResults retrieves multiple execution results for a task.

func (*MCPServer) Start

func (s *MCPServer) Start(ctx context.Context) error

Start starts the MCP server

func (*MCPServer) Stop

func (s *MCPServer) Stop() error

Stop stops the MCP server

type QueryTaskResultParams added in v0.8.0

type QueryTaskResultParams struct {
	SQL string `json:"sql" description:"SQL SELECT query to execute against the database"`
}

QueryTaskResultParams holds parameters for the query_task_result tool

type TaskIDParams

type TaskIDParams struct {
	ID string `json:"id" description:"the ID of the task to get/remove/enable/disable"`
}

TaskIDParams holds the ID parameter used by multiple handlers

type TaskParams

type TaskParams struct {
	ID          string `json:"id,omitempty" description:"task ID"`
	Name        string `json:"name" description:"task name (required)"`
	Schedule    string `` /* 169-byte string literal not displayed */
	Type        string `json:"type,omitempty" description:"task type: 'shell_command' or 'AI'"`
	Command     string `json:"command,omitempty" description:"shell command to execute (required for shell_command tasks)"`
	Description string `json:"description,omitempty" description:"task description"`
	Enabled     bool   `json:"enabled,omitempty" description:"whether the task is enabled (defaults to false; set to true to activate immediately)"`
}

TaskParams holds parameters for various task operations

type TaskResultParams

type TaskResultParams struct {
	ID    string `json:"id" description:"the ID of the task to get results for"`
	Limit int    `json:"limit,omitempty" description:"number of recent results to return (default 1, max 100)"`
}

TaskResultParams holds parameters for the get_task_result tool

type ToolDefinition

type ToolDefinition struct {
	// Name is the name of the tool
	Name string

	// Description is a brief description of what the tool does
	Description string

	// Handler is the function that will be called when the tool is invoked
	Handler func(context.Context, *mcp.CallToolRequest) (*mcp.CallToolResult, error)

	// Parameters is the parameter schema for the tool (can be a struct)
	Parameters interface{}
}

ToolDefinition represents a tool that can be registered with the MCP server

Jump to

Keyboard shortcuts

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