diff --git a/pkg/tools/execute/code.go b/pkg/tools/execute/code.go index 4592e14..189b699 100644 --- a/pkg/tools/execute/code.go +++ b/pkg/tools/execute/code.go @@ -56,6 +56,8 @@ func (e *Server) Dispatch(ctx context.Context, name string, args json.RawMessage return dispatchToolList(ctx, e, args) case "tool_load": return dispatchToolLoad(ctx, e, args) + case "tool_active": + return dispatchToolActive(ctx, e, args) default: return "", fmt.Errorf("unknown execute tool: %s", name) } @@ -192,3 +194,24 @@ func dispatchToolLoad(ctx context.Context, e *Server, args json.RawMessage) (str } return fmt.Sprintf("loaded: %s", a.Name), nil } + +// dispatchToolActive lists tools currently loaded (promoted) in this session. +func dispatchToolActive(ctx context.Context, e *Server, args json.RawMessage) (string, error) { + if e.toolRegistry == nil || e.sessionID == "" { + return "(no tools loaded)", nil + } + loaded := e.toolRegistry.Loaded(e.sessionID) + if len(loaded) == 0 { + return "(no tools loaded)", nil + } + var out strings.Builder + for _, t := range loaded { + out.WriteString(t.Name) + if t.Description != "" { + out.WriteString(" — ") + out.WriteString(t.Description) + } + out.WriteString("\n") + } + return strings.TrimRight(out.String(), "\n"), nil +} diff --git a/pkg/tools/execute/server.go b/pkg/tools/execute/server.go index 12dc177..365e473 100644 --- a/pkg/tools/execute/server.go +++ b/pkg/tools/execute/server.go @@ -176,6 +176,18 @@ After loading, the tool becomes a native callable function.`, } }`), }, + { + Name: "tool_active", + Description: `List tools currently loaded (promoted) in this session. + +Usage: (no arguments) + +Returns tools with descriptions, one per line.`, + InputSchema: json.RawMessage(`{ + "type": "object", + "properties": {} + }`), + }, } if e.toolRegistry != nil && e.sessionID != "" {