Documentation
¶
Overview ¶
Package toolkit holds what every sysml-mcp tool group shares: the annotations a tool declares about itself and the coordinate conventions tool arguments use, so the groups agree without importing one another.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Mutating ¶
func Mutating(title string, idempotent bool) *mcp.ToolAnnotations
Mutating annotates a tool that changes server state or files on disk; idempotent says whether repeating a call with the same arguments changes nothing further.
func ReadOnly ¶
func ReadOnly(title string) *mcp.ToolAnnotations
ReadOnly annotates a tool that inspects the model or the workspace and changes nothing; title is what a client shows for it.
Types ¶
type NameRole ¶
type NameRole int
NameRole is what a tool reads from a path's name, which a symlink must then agree with its target about: a link spelled `.kerml` to a `.sysml` file would otherwise be read as the wrong language.
type Option ¶
type Option func(*options)
Option adjusts one resolution.
type Position ¶
type Position struct {
Line int `json:"line" jsonschema:"1-based line number"`
Column int `json:"column" jsonschema:"1-based column number, counted in characters"`
}
Position is a place in a document as an editor shows it: 1-based line and column, the column counted in characters. Tool arguments use it rather than the protocol's 0-based UTF-16 positions, which agents get wrong.
func FromProtocol ¶
FromProtocol converts a protocol position on lineText to a 1-based Position.
type Resolved ¶
type Resolved struct {
// Path is the path as spelled, absolute and clean: a relative path joined
// to the root. It names the document to a tool and an index.
Path string
// Real is Path with its symlinks followed, the file an operation reaches;
// for a path not yet on disk, the resolved nearest existing ancestor with
// the rest of the path appended.
Real string
}
Resolved is a path Root.Resolve accepted.
type Root ¶
type Root struct {
// Dir is the root as the server was given it, made absolute and clean.
Dir string
// Real is Dir with its symlinks resolved.
Real string
}
Root is the workspace folder every file a tool touches must lie under. A path is judged twice: as spelled, against Dir, and with its symlinks followed, against Real, so neither `..` nor a link planted under the root reaches a file outside it.
func NewRoot ¶
NewRoot makes the root of dir, which must exist: a relative dir is taken from the working directory.
func (Root) Resolve ¶
Resolve turns a tool's path argument into the file it names, which must lie under the root: as spelled, so `..` and an absolute path elsewhere are refused, and once the symlinks on the way are followed, so a link out of the root is refused too, a dangling one by where it points. A path that does not exist yet is checked through its nearest existing ancestor. A relative path is taken from the root.