Skip to content

Commit 7a4853e

Browse files
fix: lint and remove close fix (to be done in a separate pr)
1 parent 323a55a commit 7a4853e

3 files changed

Lines changed: 1 addition & 27 deletions

File tree

main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,9 @@ func main() {
149149
// The returned closer tears down the private catalog connection; the
150150
// server is a process-lifetime singleton, so we intentionally leave it
151151
// open until the process exits.
152-
d, err := dynamic.Register(ctx, server, products)
153-
if err != nil {
152+
if _, err := dynamic.Register(ctx, server, products); err != nil {
154153
log.Fatalf("dynamic load mode: %v", err)
155154
}
156-
defer d.Close()
157155

158156
case LoadModeLazy:
159157
// Small products register eagerly; Compute and Object Storage defer

tools/dynamic/catalog.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ func buildCatalog(ctx context.Context, products []Product) (*dispatcher, error)
3434
client := mcp.NewClient(&mcp.Implementation{Name: "ionos-cloud-mcp-catalog-reader", Version: "internal"}, nil)
3535
session, err := client.Connect(ctx, clientT, nil)
3636
if err != nil {
37-
_ = srvSession.Close()
3837
return nil, fmt.Errorf("dynamic: connecting catalog reader: %w", err)
3938
}
4039

@@ -51,17 +50,14 @@ func buildCatalog(ctx context.Context, products []Product) (*dispatcher, error)
5150
// Attribution + dedup: register on a throwaway server and read it back.
5251
tools, err := productTools(ctx, p)
5352
if err != nil {
54-
_ = d.Close()
5553
return nil, err
5654
}
5755
for _, tool := range tools {
5856
if prev, dup := d.byName[tool.Name]; dup {
59-
_ = d.Close()
6057
return nil, fmt.Errorf("dynamic: duplicate tool name %q registered by products %q and %q", tool.Name, prev.Group, p.Name)
6158
}
6259
schema, mErr := json.Marshal(tool.InputSchema)
6360
if mErr != nil {
64-
_ = d.Close()
6561
return nil, fmt.Errorf("dynamic: marshaling input schema for %q: %w", tool.Name, mErr)
6662
}
6763
e := catalogEntry{
@@ -77,7 +73,6 @@ func buildCatalog(ctx context.Context, products []Product) (*dispatcher, error)
7773
}
7874

7975
if len(d.entries) == 0 {
80-
_ = d.Close()
8176
return nil, fmt.Errorf("dynamic: catalog is empty (no products registered any tools)")
8277
}
8378

tools/inputs.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -366,22 +366,3 @@ type CallToolInput struct {
366366
Name string `json:"name" jsonschema:"the exact name of the tool to invoke (from ionos_search_tools)"`
367367
Arguments map[string]any `json:"arguments,omitempty" jsonschema:"the tool's arguments as a JSON object; see ionos_describe_tools for the schema"`
368368
}
369-
370-
// Dynamic load-mode meta-tool input types. Used only when the server runs in
371-
// 'dynamic' mode, where these are the only tools the client sees and the full
372-
// product catalog is browsed/invoked through them.
373-
374-
type SearchToolsInput struct {
375-
Query string `json:"query" jsonschema:"keywords to match against tool names and descriptions; leave empty to browse, optionally with group"`
376-
Group *string `json:"group,omitempty" jsonschema:"restrict results to a single product group (e.g. compute, dns, billing, cert, activitylog, objectstorage, k8s)"`
377-
Limit *int `json:"limit,omitempty" jsonschema:"maximum number of results to return; omit for the default of 10, or pass 0 for no limit. Must not be negative."`
378-
}
379-
380-
type DescribeToolsInput struct {
381-
Names []string `json:"names" jsonschema:"the exact names of the tools to describe; returns each tool's description and full JSON input schema"`
382-
}
383-
384-
type CallToolInput struct {
385-
Name string `json:"name" jsonschema:"the exact name of the tool to invoke (from ionos_search_tools)"`
386-
Arguments map[string]any `json:"arguments,omitempty" jsonschema:"the tool's arguments as a JSON object; see ionos_describe_tools for the schema"`
387-
}

0 commit comments

Comments
 (0)