mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(codersdk/toolsdk): fix tool schemata (#17365)
Fixes two issues with the MCP server:
- Ensures we have a non-null schema, as the following schema was making
claude-code unhappy:
```
"inputSchema": { "type": "object", "properties": null },
```
- Skip adding the coder_report_task tool if an agent client is not
available. Otherwise the agent may try to report tasks and get confused.
This commit is contained in:
@@ -259,6 +259,10 @@ is provisioned correctly and the agent can connect to the control plane.
|
||||
Tool: aisdk.Tool{
|
||||
Name: "coder_list_templates",
|
||||
Description: "Lists templates for the authenticated user.",
|
||||
Schema: aisdk.Schema{
|
||||
Properties: map[string]any{},
|
||||
Required: []string{},
|
||||
},
|
||||
},
|
||||
Handler: func(ctx context.Context, _ map[string]any) ([]MinimalTemplate, error) {
|
||||
client, err := clientFromContext(ctx)
|
||||
@@ -318,6 +322,10 @@ is provisioned correctly and the agent can connect to the control plane.
|
||||
Tool: aisdk.Tool{
|
||||
Name: "coder_get_authenticated_user",
|
||||
Description: "Get the currently authenticated user, similar to the `whoami` command.",
|
||||
Schema: aisdk.Schema{
|
||||
Properties: map[string]any{},
|
||||
Required: []string{},
|
||||
},
|
||||
},
|
||||
Handler: func(ctx context.Context, _ map[string]any) (codersdk.User, error) {
|
||||
client, err := clientFromContext(ctx)
|
||||
|
||||
Reference in New Issue
Block a user