mcp

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultMaxResults = 1000

DefaultMaxResults caps the number of timestamps returned in a single expand_cron call to prevent memory exhaustion and oversized tool responses.

Variables

This section is empty.

Functions

func NewServer

func NewServer(opts Options) *mcp.Server

NewServer creates a configured cron2date MCP server exposing expand_cron and validate_cron.

func RunStdio

func RunStdio(ctx context.Context, opts Options) error

RunStdio runs the cron2date MCP server over standard input/output.

Types

type ExpandCronInput

type ExpandCronInput struct {
	Expr      string `json:"expr" jsonschema:"Cron expression (5-field, descriptor, or 6-field with seconds=true)"`
	Start     string `json:"start,omitempty" jsonschema:"Start timestamp in format (default: current time)"`
	End       string `json:"end,omitempty" jsonschema:"End timestamp in format"`
	Count     *int   `json:"count,omitempty" jsonschema:"Maximum number of firing times to return (0 or greater)"`
	Duration  string `json:"duration,omitempty" jsonschema:"Duration from start time (Go duration, e.g. 24h, 3h30m)"`
	Format    string `json:"format,omitempty" jsonschema:"Layout or preset (datetime, date, time, rfc3339, rfc3339nano)"`
	Timezone  string `json:"timezone,omitempty" jsonschema:"IANA timezone name (e.g. UTC, Asia/Tokyo; default: local)"`
	Seconds   bool   `json:"seconds,omitempty" jsonschema:"Parse 6-field cron expression with leading seconds field"`
	Inclusive bool   `json:"inclusive,omitempty" jsonschema:"Include start timestamp if it matches the cron expression"`
}

ExpandCronInput defines the parameters for the expand_cron tool.

type ExpandCronOutput

type ExpandCronOutput struct {
	Times     []string `json:"times" jsonschema:"Expanded firing timestamps"`
	Count     int      `json:"count" jsonschema:"Number of returned timestamps"`
	Timezone  string   `json:"timezone" jsonschema:"Effective timezone used"`
	Truncated bool     `json:"truncated" jsonschema:"True if output was capped at the server maximum limit"`
}

ExpandCronOutput defines the structured response for the expand_cron tool.

type Options

type Options struct {
	Version    string
	MaxResults int
	Now        func() time.Time
}

Options configures the cron2date MCP server.

type ValidateCronInput

type ValidateCronInput struct {
	Expr     string `json:"expr" jsonschema:"Cron expression to validate"`
	Start    string `json:"start,omitempty" jsonschema:"Reference timestamp for next firing preview (default: now)"`
	Format   string `json:"format,omitempty" jsonschema:"Go layout or preset (datetime, date, time, rfc3339, rfc3339nano)"`
	Timezone string `json:"timezone,omitempty" jsonschema:"IANA timezone name (e.g. UTC, Asia/Tokyo; default: local)"`
	Seconds  bool   `json:"seconds,omitempty" jsonschema:"Validate as a 6-field cron expression with leading seconds"`
}

ValidateCronInput defines the parameters for the validate_cron tool.

type ValidateCronOutput

type ValidateCronOutput struct {
	Valid    bool   `json:"valid" jsonschema:"Whether the cron expression is valid"`
	Error    string `json:"error,omitempty" jsonschema:"Parse error message when valid is false"`
	NextFire string `json:"next_fire,omitempty" jsonschema:"Next firing time after start, empty if never fires"`
	Timezone string `json:"timezone" jsonschema:"Effective timezone used"`
}

ValidateCronOutput defines the structured response for the validate_cron tool.

Jump to

Keyboard shortcuts

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