-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtools_clients.go
More file actions
72 lines (67 loc) · 2.65 KB
/
Copy pathtools_clients.go
File metadata and controls
72 lines (67 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main
// slide_clients: client (organisational unit) CRUD. Split out of the
// v3 slide_user_management mega-tool because in MSP workflows clients
// are touched far more often than users/accounts.
func handleClientsTool(args map[string]interface{}) (string, error) {
return HandleToolWithOperations(CreateToolConfigWithResolutions("slide_clients", ToolOperations{
"list": listClients,
"get": getClient,
"create": createClient,
"update": updateClient,
"delete": deleteClient,
}, map[string]ResolutionSpec{
"get": {IDKey: "client_id", Kind: "client"},
"update": {IDKey: "client_id", Kind: "client"},
"delete": {IDKey: "client_id", Kind: "client"},
}), args)
}
var clientsOperationEnums = []string{"list", "get", "create", "update", "delete"}
func getClientsToolInfo() ToolInfo {
props := map[string]interface{}{
"operation": map[string]interface{}{
"type": "string",
"description": "The operation to perform.",
"enum": clientsOperationEnums,
},
"client_id": map[string]interface{}{
"type": "string",
"description": "Client ID. Required for `get`, `update`, `delete` (alternative: `name_hint`).",
},
"name_hint": map[string]interface{}{
"type": "string",
"description": "Alternative to client_id on `get` / `update` / `delete`: a client name (case-insensitive substring match).",
},
"name": map[string]interface{}{
"type": "string",
"description": "Client name. Required for `create`, optional for `update`.",
},
"comments": map[string]interface{}{
"type": "string",
"description": "Free-form notes.",
},
}
for k, v := range commonListProperties() {
if _, exists := props[k]; !exists {
props[k] = v
}
}
return ToolInfo{
Name: "slide_clients",
Description: "Slide MCP - manage MSP clients (organisational units). " +
"REACH FOR THIS whenever the user mentions an MSP client by name, 'add a new client', 'list my clients', " +
"'who are my customers in Slide', or wants to update a client's details. " +
"Operations: `list`, `get`, `create`, `update`, `delete`. Accepts client_id OR name_hint on single-client operations. " +
"Use `slide_overview for_client` for a richer client + devices + agents view.",
InputSchema: map[string]interface{}{
"type": "object",
"properties": props,
"required": []string{"operation"},
"allOf": []map[string]interface{}{
{"if": ifOp("get"), "then": reqEither("client_id", "name_hint")},
{"if": ifOp("create"), "then": req("name")},
{"if": ifOp("update"), "then": reqEither("client_id", "name_hint")},
{"if": ifOp("delete"), "then": reqEither("client_id", "name_hint")},
},
},
}
}