unifi-mcp-worker 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/worker/src/relay-object.ts +18 -3
package/package.json
CHANGED
|
@@ -30,7 +30,9 @@ const MAX_LOCATION_NAME_LENGTH = 128;
|
|
|
30
30
|
const META_TOOL_INDEX: ToolInfo = {
|
|
31
31
|
name: "unifi_tool_index",
|
|
32
32
|
description:
|
|
33
|
-
"
|
|
33
|
+
"Discover available UniFi tools. Returns names and descriptions by default. " +
|
|
34
|
+
"Use 'category' to filter by area (e.g. clients, firewall, devices), " +
|
|
35
|
+
"'search' for keyword matching, or 'include_schemas' for full parameter schemas. " +
|
|
34
36
|
"Use this to discover tools before calling unifi_execute.",
|
|
35
37
|
inputSchema: {
|
|
36
38
|
type: "object",
|
|
@@ -43,6 +45,13 @@ const META_TOOL_INDEX: ToolInfo = {
|
|
|
43
45
|
type: "string",
|
|
44
46
|
description: "Optional search term to filter tools by name or description",
|
|
45
47
|
},
|
|
48
|
+
include_schemas: {
|
|
49
|
+
type: "boolean",
|
|
50
|
+
description:
|
|
51
|
+
"Include full input schemas per tool. Defaults to false. " +
|
|
52
|
+
"Set true with a category or search filter to get parameter details for specific tools.",
|
|
53
|
+
default: false,
|
|
54
|
+
},
|
|
46
55
|
},
|
|
47
56
|
},
|
|
48
57
|
annotations: {
|
|
@@ -743,6 +752,7 @@ export class RelayObject extends DurableObject<Env> implements RelayStub {
|
|
|
743
752
|
private handleToolIndex(args: Record<string, unknown>): Record<string, unknown> {
|
|
744
753
|
const category = args.category as string | undefined;
|
|
745
754
|
const search = args.search as string | undefined;
|
|
755
|
+
const includeSchemas = Boolean(args.include_schemas);
|
|
746
756
|
|
|
747
757
|
// Build tool list with location metadata
|
|
748
758
|
const toolEntries: Array<{
|
|
@@ -750,6 +760,7 @@ export class RelayObject extends DurableObject<Env> implements RelayStub {
|
|
|
750
760
|
description: string;
|
|
751
761
|
locations: string[];
|
|
752
762
|
annotations?: ToolAnnotations;
|
|
763
|
+
inputSchema?: Record<string, unknown>;
|
|
753
764
|
}> = [];
|
|
754
765
|
|
|
755
766
|
const seen = new Set<string>();
|
|
@@ -757,12 +768,16 @@ export class RelayObject extends DurableObject<Env> implements RelayStub {
|
|
|
757
768
|
for (const tool of tools) {
|
|
758
769
|
if (!seen.has(tool.name)) {
|
|
759
770
|
seen.add(tool.name);
|
|
760
|
-
toolEntries
|
|
771
|
+
const entry: (typeof toolEntries)[number] = {
|
|
761
772
|
name: tool.name,
|
|
762
773
|
description: tool.description,
|
|
763
774
|
locations: this.toolToLocations.get(tool.name) || [locationId],
|
|
764
775
|
annotations: tool.annotations,
|
|
765
|
-
}
|
|
776
|
+
};
|
|
777
|
+
if (includeSchemas && tool.inputSchema) {
|
|
778
|
+
entry.inputSchema = tool.inputSchema;
|
|
779
|
+
}
|
|
780
|
+
toolEntries.push(entry);
|
|
766
781
|
}
|
|
767
782
|
}
|
|
768
783
|
}
|