Documentation
¶
Overview ¶
Package instructions defines the configuration that sets the instructions an MCP endpoint returns to clients in its initialize and server/discover results. MCPServer, MCPRemoteProxy and VirtualMCPServer share it.
+kubebuilder:object:generate=true +groupName=toolhive.stacklok.dev +versionName=instructions
Index ¶
Constants ¶
const MaxValueLength = 65536
MaxValueLength is the most characters a value may hold. The RunConfig ConfigMap holds the value twice, in the typed field and in the middleware parameters, and JSON encodes a character in at most six bytes, so both copies stay well under the 1 MiB a ConfigMap may hold.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Mode says how value combines with the instructions the server returns.
// replace returns value alone. append returns the server's instructions,
// a blank line, and value. prepend returns value, a blank line, and the
// server's instructions. When the server returns no instructions, every
// mode returns value alone.
// +kubebuilder:validation:Enum=replace;append;prepend
// +kubebuilder:default=append
// +optional
Mode Mode `json:"mode,omitempty" yaml:"mode,omitempty"`
// Value is the text that mode combines with the server's instructions.
// Leading and trailing ASCII white space (tab, LF, FF, CR, space) is
// dropped, and a value that is only such white space is rejected.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=65536
// +kubebuilder:validation:Pattern=`\S`
Value string `json:"value" yaml:"value"`
}
Config sets the instructions an MCP endpoint returns to clients in the result of a successful initialize or server/discover request. Clients commonly add server instructions to the model's context, so this is where an operator adds policy or usage guidance without changing the server.
+gendoc
func (*Config) Apply ¶
Apply returns the instructions a client receives when the server returns server, which is empty when the server returns none. The value is used without its leading and trailing ASCII white space (see asciiSpace), so a file that ends in a newline or a YAML block adds no blank line.
func (*Config) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Config.
func (*Config) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Mode ¶
type Mode string
Mode says how the configured value combines with the instructions the server returns.
const ( // ModeReplace returns the configured value in place of the server's // instructions. ModeReplace Mode = "replace" // ModeAppend returns the server's instructions, a blank line, and then the // configured value. ModeAppend Mode = "append" // ModePrepend returns the configured value, a blank line, and then the // server's instructions. ModePrepend Mode = "prepend" )