Help us shape the future of Go! Take the 2026 Go Developer Survey

taskcheck

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package taskcheck checks a server against the Tasks extension (io.modelcontextprotocol/tasks, spec 2026-07-28): error codes of the tasks/* methods without calling a tool, and with a tool given the whole life of one task — handle, durable creation, polling, statuses, results.

Index

Constants

View Source
const (
	NotificationTasks = "notifications/tasks"
	NotificationAcked = "notifications/subscriptions/acknowledged"
)

Notifications of the extension, recorded by a client.NotificationTap.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker struct {
	Session *mcp.ClientSession
	// Tool, if set, is called as a task to check a task's life; without it
	// only the tasks/* methods are probed. The tool is called twice: once
	// without and once with the extension declared.
	Tool string
	Args map[string]any
	// Cancel cancels the task right after it was created.
	Cancel bool
	// Responder answers input requests; without one an input_required task
	// is cancelled.
	Responder *client.Responder
	// Tap records notifications/tasks and subscription acknowledgements; with
	// it the task's notifications are checked too. It must wrap the
	// session's transport.
	Tap *client.NotificationTap
	// Other is a session of a second identity (other credentials) to the same
	// server; with it, another identity's access to the task is checked.
	Other *mcp.ClientSession
	// Timeout bounds the wait for a terminal status (default 2 minutes).
	Timeout time.Duration
	// PlainWait bounds the call without the extension (default 5 seconds).
	PlainWait time.Duration
}

Checker runs the checks over a session.

func (*Checker) Run

func (c *Checker) Run(ctx context.Context) *Report

Run probes the tasks/* methods and, with a tool, the life of one task.

type Report

type Report struct {
	Declared bool     `json:"declared"`
	Tool     string   `json:"tool,omitempty"`
	TaskID   string   `json:"taskId,omitempty"`
	Statuses []string `json:"statuses,omitempty"` // observed status sequence, without repeats
	Results  []Result `json:"results"`
}

Report is the outcome of a check run.

func (*Report) Failed

func (r *Report) Failed() bool

Failed reports whether any check failed.

func (*Report) FailedNames

func (r *Report) FailedNames() []string

FailedNames returns the names of the failed checks.

type Result

type Result struct {
	Name   string `json:"name"`
	Status Status `json:"status"`
	Detail string `json:"detail,omitempty"`
}

Result is the outcome of one check.

type Status

type Status string

Status of one check.

const (
	Pass Status = "PASS"
	Fail Status = "FAIL" // a MUST is violated
	Warn Status = "WARN" // a SHOULD is violated
	Skip Status = "SKIP"
)

Jump to

Keyboard shortcuts

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