Skip to content

Commit 67f7477

Browse files
authored
feat: add readonly hint annotations (#48)
1 parent f97fae4 commit 67f7477

26 files changed

+287
-60
lines changed

.mcp.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"mcpServers": {
3+
"sysdig": {
4+
"type": "stdio",
5+
"command": "go",
6+
"args": [
7+
"run",
8+
"./cmd/server/"
9+
]
10+
}
11+
}
12+
}

AGENTS.md

Lines changed: 229 additions & 59 deletions
Large diffs are not rendered by default.

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@AGENTS.md

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
mkShell {
3333
packages = [
3434
ginkgo
35-
go_1_25
35+
go
3636
gofumpt
3737
golangci-lint
3838
just

internal/infra/mcp/tools/tool_generate_sysql.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ func (h *ToolGenerateSysql) RegisterInServer(s *server.MCPServer) {
5353
),
5454
),
5555
mcp.WithOutputSchema[map[string]any](),
56+
mcp.WithReadOnlyHintAnnotation(true),
57+
mcp.WithDestructiveHintAnnotation(false),
5658
WithRequiredPermissions("sage.exec"),
5759
)
5860
s.AddTool(tool, h.handle)

internal/infra/mcp/tools/tool_get_event_info.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ func (h *ToolGetEventInfo) RegisterInServer(s *server.MCPServer) {
4343
mcp.Required(),
4444
),
4545
mcp.WithOutputSchema[map[string]any](),
46+
mcp.WithReadOnlyHintAnnotation(true),
47+
mcp.WithDestructiveHintAnnotation(false),
4648
WithRequiredPermissions("policy-events.read"),
4749
)
4850

internal/infra/mcp/tools/tool_get_event_process_tree.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ func (h *ToolGetEventProcessTree) RegisterInServer(s *server.MCPServer) {
6161
mcp.Required(),
6262
),
6363
mcp.WithOutputSchema[map[string]any](),
64+
mcp.WithReadOnlyHintAnnotation(true),
65+
mcp.WithDestructiveHintAnnotation(false),
6466
WithRequiredPermissions("policy-events.read"),
6567
)
6668

internal/infra/mcp/tools/tool_kubernetes_list_clusters.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ func (t *KubernetesListClusters) RegisterInServer(s *server.MCPServer) {
3030
mcp.DefaultNumber(10),
3131
),
3232
mcp.WithOutputSchema[map[string]any](),
33+
mcp.WithReadOnlyHintAnnotation(true),
34+
mcp.WithDestructiveHintAnnotation(false),
3335
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
3436
)
3537
s.AddTool(tool, t.handle)

internal/infra/mcp/tools/tool_kubernetes_list_cronjobs.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ func (t *KubernetesListCronjobs) RegisterInServer(s *server.MCPServer) {
3333
mcp.DefaultNumber(10),
3434
),
3535
mcp.WithOutputSchema[map[string]any](),
36+
mcp.WithReadOnlyHintAnnotation(true),
37+
mcp.WithDestructiveHintAnnotation(false),
3638
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
3739
)
3840
s.AddTool(tool, t.handle)

internal/infra/mcp/tools/tool_kubernetes_list_nodes.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ func (t *KubernetesListNodes) RegisterInServer(s *server.MCPServer) {
3232
mcp.DefaultNumber(10),
3333
),
3434
mcp.WithOutputSchema[map[string]any](),
35+
mcp.WithReadOnlyHintAnnotation(true),
36+
mcp.WithDestructiveHintAnnotation(false),
3537
WithRequiredPermissions(), // FIXME(fede): Add the required permissions. It should be `promql.exec` but somehow the token does not have that permission even if you are able to execute queries.
3638
)
3739
s.AddTool(tool, t.handle)

0 commit comments

Comments
 (0)