Documentation
¶
Overview ¶
Package skillstest is a fake upstream MCP server that serves skills over raw JSON-RPC on HTTP. It is not built on mcp-go's server because that server answers unknown methods with METHOD_NOT_FOUND and has no hook to add skills/list or skills/get.
Index ¶
- type Fixture
- func (f *Fixture) AddRawEntry(entry json.RawMessage)
- func (f *Fixture) AddSkill(s Skill)
- func (f *Fixture) Count(method string) int
- func (f *Fixture) Methods() []string
- func (f *Fixture) Mutate(path, file string, content []byte)
- func (f *Fixture) Requests() []Request
- func (f *Fixture) SetDelay(d time.Duration)
- func (f *Fixture) SetListFailure(fail bool)
- func (f *Fixture) URL() string
- type Option
- type Request
- type Skill
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fixture ¶
type Fixture struct {
// contains filtered or unexported fields
}
Fixture is the fake upstream. It is safe for concurrent use.
func (*Fixture) AddRawEntry ¶
func (f *Fixture) AddRawEntry(entry json.RawMessage)
AddSkill registers a skill. Digests and sizes in the listing are computed from the current bytes each time, so they are correct unless a knob says otherwise. AddRawEntry appends one listing entry exactly as given, after the skills added with AddSkill. It is how a test lists something AddSkill cannot express: a malformed entry, or a second address for a path already listed. Nothing is served for it on skills/get or resources/read.
func (*Fixture) Mutate ¶
Mutate replaces one file's bytes. The listing follows, so a later skills/list reports the new digest and size.
func (*Fixture) SetListFailure ¶
SetListFailure makes skills/list answer with a JSON-RPC error.
type Option ¶
type Option func(*Fixture)
Option configures New.
func WithPageSize ¶
WithPageSize makes skills/list return at most n entries per page.
func WithoutExtension ¶
func WithoutExtension() Option
WithoutExtension leaves the skills extension out of the initialize result.
func WithoutResources ¶
func WithoutResources() Option
WithoutResources leaves the resources capability out of the initialize result.
type Request ¶
type Request struct {
Method string
// URI is params.uri when present.
URI string
// Cursor is params.cursor when present.
Cursor string
}
Request is one JSON-RPC message the fixture received.
type Skill ¶
type Skill struct {
Path string
Files map[string][]byte
// ListedFrontmatter replaces the frontmatter in the listing; SKILL.md keeps
// its own, so the two disagree.
ListedFrontmatter map[string]any
// Dynamic lists resources as the string "dynamic".
Dynamic bool
// WrongDigest and WrongSize list a digest or size that the served bytes do
// not match.
WrongDigest []string
WrongSize []string
// Binary serves the file as a base64 blob instead of text.
Binary []string
// Oversize serves the file with this many extra bytes while the listing
// keeps the original size.
Oversize map[string]int
// ListedSize lists this size for the file, whatever its real length.
ListedSize map[string]int64
}
Skill describes one skill the fixture serves. Path is the part of the skill address after "skill://", for example "pdf" or "acme/billing/refunds". Files maps a path inside the skill to its bytes; SKILL.md is generated when absent.
The knobs below make the fixture lie in one specific way so a test can prove the consumer notices. They name files by their path inside the skill.