Skip to content

Commit 42c121a

Browse files
committed
fixed: better description for get resource
Without these details some models do not understand that they can call it for cluster resources too
1 parent d5aa8bb commit 42c121a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

internal/tools/get_resource_tool.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func NewGetResourceTool(pool k8s.ClientPool) fxctx.Tool {
2626

2727
inputSchema := toolinput.NewToolInputSchema(
2828
toolinput.WithString(contextProperty, "Name of the Kubernetes context to use, defaults to current context"),
29-
toolinput.WithString(namespaceProperty, "Namespace to get resource from"),
29+
toolinput.WithString(namespaceProperty, "Namespace to get resource from, skip for cluster resources"),
3030
toolinput.WithString(groupProperty, "API Group of the resource to get"),
3131
toolinput.WithString(versionProperty, "API Version of the resource to get"),
3232
toolinput.WithRequiredString(kindProperty, "Kind of resource to get"),
@@ -37,10 +37,10 @@ func NewGetResourceTool(pool k8s.ClientPool) fxctx.Tool {
3737
return fxctx.NewTool(
3838
&mcp.Tool{
3939
Name: "get-k8s-resource",
40-
Description: utils.Ptr("Get Kubernetes resource completely"),
40+
Description: utils.Ptr("Get details of any Kubernetes resource like pod, node or service - completely as JSON or rendered using template"),
4141
InputSchema: inputSchema.GetMcpToolInputSchema(),
4242
},
43-
func(_ context.Context, args map[string]interface{}) *mcp.CallToolResult {
43+
func(_ context.Context, args map[string]any) *mcp.CallToolResult {
4444
input, err := inputSchema.Validate(args)
4545
if err != nil {
4646
return utils.ErrResponse(err)

testdata/list_tools_test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ out:
5151
},
5252
{
5353
"name": "get-k8s-resource",
54-
"description": "Get Kubernetes resource completely",
54+
"description": "Get details of any Kubernetes resource like pod, node or service - completely as JSON or rendered using template",
5555
"inputSchema":
5656
{
5757
"type": "object",
@@ -65,7 +65,7 @@ out:
6565
"namespace":
6666
{
6767
"type": "string",
68-
"description": "Namespace to get resource from",
68+
"description": "Namespace to get resource from, skip for cluster resources",
6969
},
7070
"name":
7171
{
@@ -88,7 +88,7 @@ out:
8888
"description": "Kind of resource to get",
8989
},
9090
},
91-
"required": ["namespace", "kind", "name"],
91+
"required": ["kind", "name"],
9292
},
9393
},
9494
{

0 commit comments

Comments
 (0)