Skip to content

Conversation

@triepod-ai
Copy link

Summary

Adds MCP tool annotations (readOnlyHint, destructiveHint, title) to all 10 tools across 4 registry files to help LLMs better understand tool behavior and make safer decisions about tool execution.

Changes

pkg/kubectl/registry.go (7 tools)

Tool Annotation Notes
kubectl_resources Conditional readOnlyHint when readOnly=true, destructiveHint when readOnly=false
kubectl_workloads destructiveHint: true run, scale, rollout operations
kubectl_metadata destructiveHint: true label, annotate, set operations
kubectl_diagnostics destructiveHint: true exec can run arbitrary commands
kubectl_cluster readOnlyHint: true cluster-info, explain only
kubectl_config Conditional readOnlyHint when readOnly=true, destructiveHint when readOnly=false
call_kubectl Conditional Based on accessLevel parameter

Other Registries (3 tools)

File Tool Annotation Reason
pkg/helm/registry.go call_helm destructiveHint: true install/upgrade/uninstall
pkg/cilium/registry.go call_cilium destructiveHint: true can modify network policies
pkg/hubble/registry.go call_hubble readOnlyHint: true observability only

Why This Matters

  • Annotations provide semantic metadata that helps LLMs understand tool behavior
  • LLMs can make better decisions about when to use tools and in what order
  • Enables safer tool execution by distinguishing read-only from destructive operations
  • MCP clients like Claude Code can auto-approve read-only tools while prompting for destructive ones

Testing

  • Project builds successfully (go build ./...)
  • All tests pass (go test ./pkg/...)
  • Annotation values match actual tool behavior
  • Conditional annotations correctly match readOnly/accessLevel parameters

🤖 Generated with Claude Code

Add readOnlyHint and destructiveHint annotations to all 10 MCP tools
to help LLMs better understand tool behavior and make safer decisions.

Changes:
- pkg/kubectl/registry.go: Added annotations to 7 kubectl tools
  - kubectl_resources: conditional (readOnly param)
  - kubectl_workloads: destructiveHint
  - kubectl_metadata: destructiveHint
  - kubectl_diagnostics: destructiveHint (exec can run commands)
  - kubectl_cluster: readOnlyHint (info only)
  - kubectl_config: conditional (readOnly param)
  - call_kubectl: conditional (accessLevel param)
- pkg/helm/registry.go: call_helm with destructiveHint
- pkg/cilium/registry.go: call_cilium with destructiveHint
- pkg/hubble/registry.go: call_hubble with readOnlyHint

This improves tool safety metadata for MCP clients.

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Member

@gossion gossion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for contribution

@gossion gossion merged commit a3f96d7 into Azure:main Dec 30, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants