Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions internal/tools/looker/lookercreateagent/lookercreateagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,12 @@ func (cfg Config) Initialize(srcs map[string]sources.Source) (tools.Tool, error)
codeInterpreterParameter := parameters.NewBooleanParameterWithDefault("code_interpreter", false, "Optional. Enables Code Interpreter for this Agent.")
params := parameters.Parameters{nameParameter, instructionsParameter, sourcesParameter, codeInterpreterParameter}

annotations := cfg.Annotations
if annotations == nil {
readOnlyHint := false
annotations = &tools.ToolAnnotations{
ReadOnlyHint: &readOnlyHint,
}
annotations := &tools.ToolAnnotations{}
if cfg.Annotations != nil {
*annotations = *cfg.Annotations
}
readOnlyHint := false
annotations.ReadOnlyHint = &readOnlyHint

mcpManifest := tools.GetMcpManifest(cfg.Name, cfg.Description, cfg.AuthRequired, params, annotations)

Expand Down
29 changes: 29 additions & 0 deletions internal/tools/looker/lookercreateagent/lookercreateagent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,32 @@ func TestMcpManifest(t *testing.T) {
}
}
}

func TestAnnotations(t *testing.T) {
readOnlyTrue := true
cfg := lkr.Config{
Name: "test_tool",
Type: "looker-create-agent",
Source: "my-instance",
Description: "test description",
Annotations: &tools.ToolAnnotations{
ReadOnlyHint: &readOnlyTrue,
},
}

tool, err := cfg.Initialize(nil)
if err != nil {
t.Fatalf("failed to initialize tool: %v", err)
}

mcp := tool.McpManifest()
if mcp.Annotations == nil {
t.Fatal("mcp manifest annotations is nil")
}
if mcp.Annotations.ReadOnlyHint == nil {
t.Fatal("mcp manifest ReadOnlyHint is nil")
}
if *mcp.Annotations.ReadOnlyHint != false {
t.Errorf("ReadOnlyHint should be false, got %v", *mcp.Annotations.ReadOnlyHint)
}
}
15 changes: 7 additions & 8 deletions internal/tools/looker/lookerdeleteagent/lookerdeleteagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,14 @@ func (cfg Config) Initialize(srcs map[string]sources.Source) (tools.Tool, error)
agentIdParameter := parameters.NewStringParameterWithDefault("agent_id", "", "The ID of the agent.")
params := parameters.Parameters{agentIdParameter}

annotations := cfg.Annotations
if annotations == nil {
readOnlyHint := false
destructiveHint := true
annotations = &tools.ToolAnnotations{
ReadOnlyHint: &readOnlyHint,
DestructiveHint: &destructiveHint,
}
annotations := &tools.ToolAnnotations{}
if cfg.Annotations != nil {
*annotations = *cfg.Annotations
}
readOnlyHint := false
destructiveHint := true
annotations.ReadOnlyHint = &readOnlyHint
annotations.DestructiveHint = &destructiveHint

mcpManifest := tools.GetMcpManifest(cfg.Name, cfg.Description, cfg.AuthRequired, params, annotations)

Expand Down
37 changes: 37 additions & 0 deletions internal/tools/looker/lookerdeleteagent/lookerdeleteagent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,40 @@ func TestMcpManifest(t *testing.T) {
}
}
}

func TestAnnotations(t *testing.T) {
readOnlyTrue := true
destructiveFalse := false
cfg := lkr.Config{
Name: "test_tool",
Type: "looker-delete-agent",
Source: "my-instance",
Description: "test description",
Annotations: &tools.ToolAnnotations{
ReadOnlyHint: &readOnlyTrue,
DestructiveHint: &destructiveFalse,
},
}

tool, err := cfg.Initialize(nil)
if err != nil {
t.Fatalf("failed to initialize tool: %v", err)
}

mcp := tool.McpManifest()
if mcp.Annotations == nil {
t.Fatal("mcp manifest annotations is nil")
}
if mcp.Annotations.ReadOnlyHint == nil {
t.Fatal("mcp manifest ReadOnlyHint is nil")
}
if *mcp.Annotations.ReadOnlyHint != false {
t.Errorf("ReadOnlyHint should be false, got %v", *mcp.Annotations.ReadOnlyHint)
}
if mcp.Annotations.DestructiveHint == nil {
t.Fatal("mcp manifest DestructiveHint is nil")
}
if *mcp.Annotations.DestructiveHint != true {
t.Errorf("DestructiveHint should be true, got %v", *mcp.Annotations.DestructiveHint)
}
}
11 changes: 5 additions & 6 deletions internal/tools/looker/lookergetagent/lookergetagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,12 @@ func (cfg Config) Initialize(srcs map[string]sources.Source) (tools.Tool, error)
agentIdParameter := parameters.NewStringParameterWithDefault("agent_id", "", "The ID of the agent.")
params := parameters.Parameters{agentIdParameter}

annotations := cfg.Annotations
if annotations == nil {
readOnlyHint := true
annotations = &tools.ToolAnnotations{
ReadOnlyHint: &readOnlyHint,
}
annotations := &tools.ToolAnnotations{}
if cfg.Annotations != nil {
*annotations = *cfg.Annotations
}
readOnlyHint := true
annotations.ReadOnlyHint = &readOnlyHint

mcpManifest := tools.GetMcpManifest(cfg.Name, cfg.Description, cfg.AuthRequired, params, annotations)

Expand Down
29 changes: 29 additions & 0 deletions internal/tools/looker/lookergetagent/lookergetagent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,32 @@ func TestMcpManifest(t *testing.T) {
}
}
}

func TestAnnotations(t *testing.T) {
readOnlyFalse := false
cfg := lkr.Config{
Name: "test_tool",
Type: "looker-get-agent",
Source: "my-instance",
Description: "test description",
Annotations: &tools.ToolAnnotations{
ReadOnlyHint: &readOnlyFalse,
},
}

tool, err := cfg.Initialize(nil)
if err != nil {
t.Fatalf("failed to initialize tool: %v", err)
}

mcp := tool.McpManifest()
if mcp.Annotations == nil {
t.Fatal("mcp manifest annotations is nil")
}
if mcp.Annotations.ReadOnlyHint == nil {
t.Fatal("mcp manifest ReadOnlyHint is nil")
}
if *mcp.Annotations.ReadOnlyHint != true {
t.Errorf("ReadOnlyHint should be true, got %v", *mcp.Annotations.ReadOnlyHint)
}
}
11 changes: 5 additions & 6 deletions internal/tools/looker/lookerlistagents/lookerlistagents.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,12 @@ func (cfg Config) ToolConfigType() string {
func (cfg Config) Initialize(srcs map[string]sources.Source) (tools.Tool, error) {
params := parameters.Parameters{}

annotations := cfg.Annotations
if annotations == nil {
readOnlyHint := true
annotations = &tools.ToolAnnotations{
ReadOnlyHint: &readOnlyHint,
}
annotations := &tools.ToolAnnotations{}
if cfg.Annotations != nil {
*annotations = *cfg.Annotations
}
readOnlyHint := true
annotations.ReadOnlyHint = &readOnlyHint

mcpManifest := tools.GetMcpManifest(cfg.Name, cfg.Description, cfg.AuthRequired, params, annotations)

Expand Down
29 changes: 29 additions & 0 deletions internal/tools/looker/lookerlistagents/lookerlistagents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,32 @@ func TestMcpManifest(t *testing.T) {
}
}
}

func TestAnnotations(t *testing.T) {
readOnlyFalse := false
cfg := lkr.Config{
Name: "test_tool",
Type: "looker-list-agents",
Source: "my-instance",
Description: "test description",
Annotations: &tools.ToolAnnotations{
ReadOnlyHint: &readOnlyFalse,
},
}

tool, err := cfg.Initialize(nil)
if err != nil {
t.Fatalf("failed to initialize tool: %v", err)
}

mcp := tool.McpManifest()
if mcp.Annotations == nil {
t.Fatal("mcp manifest annotations is nil")
}
if mcp.Annotations.ReadOnlyHint == nil {
t.Fatal("mcp manifest ReadOnlyHint is nil")
}
if *mcp.Annotations.ReadOnlyHint != true {
t.Errorf("ReadOnlyHint should be true, got %v", *mcp.Annotations.ReadOnlyHint)
}
}
11 changes: 5 additions & 6 deletions internal/tools/looker/lookerupdateagent/lookerupdateagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,12 @@ func (cfg Config) Initialize(srcs map[string]sources.Source) (tools.Tool, error)
codeInterpreterParameter := parameters.NewBooleanParameterWithDefault("code_interpreter", false, "Optional. Enables Code Interpreter for this Agent.")
params := parameters.Parameters{agentIdParameter, nameParameter, instructionsParameter, sourcesParameter, codeInterpreterParameter}

annotations := cfg.Annotations
if annotations == nil {
readOnlyHint := false
annotations = &tools.ToolAnnotations{
ReadOnlyHint: &readOnlyHint,
}
annotations := &tools.ToolAnnotations{}
if cfg.Annotations != nil {
*annotations = *cfg.Annotations
}
readOnlyHint := false
annotations.ReadOnlyHint = &readOnlyHint

mcpManifest := tools.GetMcpManifest(cfg.Name, cfg.Description, cfg.AuthRequired, params, annotations)

Expand Down
29 changes: 29 additions & 0 deletions internal/tools/looker/lookerupdateagent/lookerupdateagent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,32 @@ func TestMcpManifest(t *testing.T) {
}
}
}

func TestAnnotations(t *testing.T) {
readOnlyTrue := true
cfg := lkr.Config{
Name: "test_tool",
Type: "looker-update-agent",
Source: "my-instance",
Description: "test description",
Annotations: &tools.ToolAnnotations{
ReadOnlyHint: &readOnlyTrue,
},
}

tool, err := cfg.Initialize(nil)
if err != nil {
t.Fatalf("failed to initialize tool: %v", err)
}

mcp := tool.McpManifest()
if mcp.Annotations == nil {
t.Fatal("mcp manifest annotations is nil")
}
if mcp.Annotations.ReadOnlyHint == nil {
t.Fatal("mcp manifest ReadOnlyHint is nil")
}
if *mcp.Annotations.ReadOnlyHint != false {
t.Errorf("ReadOnlyHint should be false, got %v", *mcp.Annotations.ReadOnlyHint)
}
}