chore: embed ToolsetConfig into Toolset (#1885)

To keep a persistent backend storage for configuration, we will have to
keep a single source of truth. This involves supporting bi-directional
conversion between ToolsetConfig and Toolset.


This PR make the following changes:
* Embed ToolsetConfig in Toolset
* Add `ToConfig()` to extract ToolsetConfig from Toolset.
This commit is contained in:
Yuan Teoh
2025-11-13 16:53:35 -08:00
committed by GitHub
parent 927881ffb9
commit f6804420b9
2 changed files with 9 additions and 2 deletions

View File

@@ -147,7 +147,10 @@ func TestUpdateServer(t *testing.T) {
newTools := map[string]tools.Tool{"example-tool": nil}
newToolsets := map[string]tools.Toolset{
"example-toolset": {
Name: "example-toolset", Tools: []*tools.Tool{},
ToolsetConfig: tools.ToolsetConfig{
Name: "example-toolset",
},
Tools: []*tools.Tool{},
},
}
newPrompts := map[string]prompts.Prompt{"example-prompt": nil}

View File

@@ -25,12 +25,16 @@ type ToolsetConfig struct {
}
type Toolset struct {
Name string `yaml:"name"`
ToolsetConfig
Tools []*Tool `yaml:",inline"`
Manifest ToolsetManifest `yaml:",inline"`
McpManifest []McpManifest `yaml:",inline"`
}
func (t Toolset) ToConfig() ToolsetConfig {
return t.ToolsetConfig
}
type ToolsetManifest struct {
ServerVersion string `json:"serverVersion"`
ToolsManifest map[string]Manifest `json:"tools"`