@xynogen/pix-9router 0.3.3 → 0.3.4
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/src/fetch.ts +2 -1
- package/src/search.ts +2 -1
- package/src/tool-schema.test.ts +40 -0
package/package.json
CHANGED
package/src/fetch.ts
CHANGED
|
@@ -118,7 +118,8 @@ export default function registerFetch(pi: ExtensionAPI): void {
|
|
|
118
118
|
parameters: Type.Object({
|
|
119
119
|
url: Type.String({ description: "URL to fetch" }),
|
|
120
120
|
format: StringEnum(["markdown", "text", "html"] as const, {
|
|
121
|
-
description:
|
|
121
|
+
description:
|
|
122
|
+
'Required choice. Enter exactly "markdown" for readable Markdown, "text" for plain text, or "html" for raw HTML.',
|
|
122
123
|
}),
|
|
123
124
|
max_characters: Type.Optional(
|
|
124
125
|
Type.Number({
|
package/src/search.ts
CHANGED
|
@@ -138,7 +138,8 @@ export default function registerSearch(pi: ExtensionAPI): void {
|
|
|
138
138
|
parameters: Type.Object({
|
|
139
139
|
query: Type.String({ description: "Search query" }),
|
|
140
140
|
search_type: StringEnum(["web", "news"] as const, {
|
|
141
|
-
description:
|
|
141
|
+
description:
|
|
142
|
+
'Required choice. Enter exactly "web" for general web results or "news" for recent news articles.',
|
|
142
143
|
}),
|
|
143
144
|
max_results: Type.Optional(
|
|
144
145
|
Type.Number({
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import registerFetch from "./fetch.ts";
|
|
3
|
+
import registerSearch from "./search.ts";
|
|
4
|
+
|
|
5
|
+
function captureParameters(register: (pi: never) => void): {
|
|
6
|
+
properties: Record<string, { type?: string; enum?: string[]; description?: string }>;
|
|
7
|
+
} {
|
|
8
|
+
let parameters: unknown;
|
|
9
|
+
register({
|
|
10
|
+
registerTool(tool: { parameters: unknown }) {
|
|
11
|
+
parameters = tool.parameters;
|
|
12
|
+
},
|
|
13
|
+
} as never);
|
|
14
|
+
if (!parameters) throw new Error("tool parameters not captured");
|
|
15
|
+
return parameters as {
|
|
16
|
+
properties: Record<string, { type?: string; enum?: string[]; description?: string }>;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
describe("enum-like tool parameters", () => {
|
|
21
|
+
test("search_type exposes values and their semantics", () => {
|
|
22
|
+
const searchType = captureParameters(registerSearch).properties.search_type;
|
|
23
|
+
if (!searchType) throw new Error("search_type schema not found");
|
|
24
|
+
|
|
25
|
+
expect(searchType.type).toBe("string");
|
|
26
|
+
expect(searchType.enum).toEqual(["web", "news"]);
|
|
27
|
+
expect(searchType.description).toContain('exactly "web"');
|
|
28
|
+
expect(searchType.description).toContain('"news"');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("fetch format exposes values and their semantics", () => {
|
|
32
|
+
const format = captureParameters(registerFetch).properties.format;
|
|
33
|
+
if (!format) throw new Error("format schema not found");
|
|
34
|
+
|
|
35
|
+
expect(format.type).toBe("string");
|
|
36
|
+
expect(format.enum).toEqual(["markdown", "text", "html"]);
|
|
37
|
+
expect(format.description).toContain('exactly "markdown"');
|
|
38
|
+
expect(format.description).toContain('"html"');
|
|
39
|
+
});
|
|
40
|
+
});
|