Skip to content

Commit ca1e655

Browse files
Yuan325rahulpinto19
authored andcommitted
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.
1 parent fd9c082 commit ca1e655

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

internal/server/server_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ func TestUpdateServer(t *testing.T) {
147147
newTools := map[string]tools.Tool{"example-tool": nil}
148148
newToolsets := map[string]tools.Toolset{
149149
"example-toolset": {
150-
Name: "example-toolset", Tools: []*tools.Tool{},
150+
ToolsetConfig: tools.ToolsetConfig{
151+
Name: "example-toolset",
152+
},
153+
Tools: []*tools.Tool{},
151154
},
152155
}
153156
newPrompts := map[string]prompts.Prompt{"example-prompt": nil}

internal/tools/toolsets.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ type ToolsetConfig struct {
2525
}
2626

2727
type Toolset struct {
28-
Name string `yaml:"name"`
28+
ToolsetConfig
2929
Tools []*Tool `yaml:",inline"`
3030
Manifest ToolsetManifest `yaml:",inline"`
3131
McpManifest []McpManifest `yaml:",inline"`
3232
}
3333

34+
func (t Toolset) ToConfig() ToolsetConfig {
35+
return t.ToolsetConfig
36+
}
37+
3438
type ToolsetManifest struct {
3539
ServerVersion string `json:"serverVersion"`
3640
ToolsManifest map[string]Manifest `json:"tools"`

0 commit comments

Comments
 (0)