opencode-search 1.0.0-next.8 → 1.0.0-next.9

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/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # opencode-search
2
2
 
3
- An [OpenCode](https://opencode.ai) plugin that gives your agent access to DuckDuckGo, Brave, Google News, Wikipedia, Bluesky, and MDN Web Docs.
3
+ An [OpenCode](https://opencode.ai) plugin that gives your agent access to DuckDuckGo, Brave, Google News, Wikipedia, Bluesky, MDN Web Docs, and the IETF, W3C and WHATWG specifications.
4
4
 
5
- <img width="786" height="377" alt="image" src="https://github.com/user-attachments/assets/9ad19ade-402a-4cc1-9882-a33d2a8e4d42" />
5
+ <img width="776" height="393" alt="image" src="https://github.com/user-attachments/assets/7b9c0776-94a9-4184-9541-1f3bf8d9bcaa" />
6
6
 
7
7
  ## What this adds over OpenCode's built-in tools
8
8
 
9
- Six search tools that work without an API key. OpenCode 1 has no web search at all unless you use its own provider, and OpenCode 2's requires a key for Exa, Firecrawl, Parallel or Tavily.
9
+ Nine search tools that work without an API key. OpenCode 1 has no web search at all unless you use its own provider, and OpenCode 2's requires a key for Exa, Firecrawl, Parallel or Tavily.
10
10
 
11
- Four of the tools search sources a general web search does not reach: Bluesky posts through the AT Protocol, Wikipedia and MDN through their own APIs, and Google News for what is being published now.
11
+ Seven of the tools search sources a general web search does not reach: Bluesky posts through the AT Protocol, Wikipedia and MDN through their own APIs, Google News for what is being published now, and the IETF, W3C and WHATWG specification indexes directly.
12
12
 
13
13
  **Use at your own risk:** the DuckDuckGo and Brave providers scrape HTML nobody promised would stay parseable, so they can break without warning and may run against a service's terms. Results are unverified input.
14
14
 
@@ -100,6 +100,35 @@ Search MDN Web Docs. Returns documentation pages for web technologies with title
100
100
  | `limit` | number | no | Number of results to return |
101
101
  | `page` | number | no | Page number for pagination |
102
102
 
103
- ## License
103
+ ### rfc_search
104
104
 
105
- MIT
105
+ Search IETF RFCs by title via the [Datatracker API](https://datatracker.ietf.org/api/). Returns RFC number, title, date, and abstract. No API key required.
106
+
107
+ | Parameter | Type | Required | Description |
108
+ | --------- | ------ | -------- | ---------------------------------- |
109
+ | `query` | string | yes | |
110
+ | `limit` | number | no | Number of results (default 20) |
111
+
112
+ Matches on title only, so a query is a phrase from the RFC's name rather than its body.
113
+
114
+ ### w3c_search
115
+
116
+ Search W3C specifications by title via the [W3C API](https://api.w3.org/). Returns the spec title and URL. No API key required.
117
+
118
+ | Parameter | Type | Required | Description |
119
+ | --------- | ------ | -------- | ---------------------------------- |
120
+ | `query` | string | yes | |
121
+ | `limit` | number | no | Number of results (default 20) |
122
+
123
+ The W3C API accepts a `q` parameter and ignores it — a real query and a nonsense string both return all 1713 specifications. So the full index is fetched, two pages of 1000, and filtered here. Titles only; the API exposes no abstracts.
124
+
125
+ ### whatwg_search
126
+
127
+ Search WHATWG living standards. Returns the standard name, URL, and description. No API key required.
128
+
129
+ | Parameter | Type | Required | Description |
130
+ | --------- | ------ | -------- | ---------------------------------- |
131
+ | `query` | string | yes | |
132
+ | `limit` | number | no | Number of results (default 20) |
133
+
134
+ WHATWG publishes its whole index as one small JSON file and offers no search endpoint, so matching happens here across names and descriptions. There are only 27 standards, so expect few results.
package/dist/package.json CHANGED
@@ -1,20 +1,25 @@
1
1
  {
2
2
  "name": "opencode-search",
3
- "version": "1.0.0-next.8",
4
- "description": "OpenCode plugin that provides web search tools using DuckDuckGo, Brave, Google News, Wikipedia, Bluesky, and MDN Web Docs.",
3
+ "version": "1.0.0-next.9",
4
+ "description": "OpenCode plugin that provides web search tools using DuckDuckGo, Brave, Google News, Wikipedia, Bluesky, MDN Web Docs, and the IETF, W3C and WHATWG specifications.",
5
5
  "keywords": [
6
+ "atproto",
7
+ "bluesky",
8
+ "brave",
9
+ "duckduckgo",
10
+ "google-news",
11
+ "ietf",
12
+ "mdn",
6
13
  "opencode",
7
14
  "opencode-plugin",
8
15
  "plugin",
16
+ "rfc",
9
17
  "search",
18
+ "specifications",
19
+ "w3c",
10
20
  "web-search",
11
- "duckduckgo",
12
- "brave",
13
- "google-news",
14
- "wikipedia",
15
- "mdn",
16
- "bluesky",
17
- "atproto"
21
+ "whatwg",
22
+ "wikipedia"
18
23
  ],
19
24
  "homepage": "https://github.com/whaaaley/opencode-search#readme",
20
25
  "bugs": {
@@ -0,0 +1,9 @@
1
+ export type RfcResult = {
2
+ id: string;
3
+ title: string;
4
+ url: string;
5
+ date: string;
6
+ abstract: string;
7
+ };
8
+ export declare const rfcSearch: (query: string, limit?: number) => Promise<RfcResult[]>;
9
+ //# sourceMappingURL=rfc-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rfc-search.d.ts","sourceRoot":"","sources":["../../../src/providers/rfc-search.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AASD,eAAO,MAAM,SAAS,GAAU,OAAO,MAAM,EAAE,cAAqB,KAAG,OAAO,CAAC,SAAS,EAAE,CAoCzF,CAAA"}
@@ -0,0 +1,35 @@
1
+ import * as cache from "../cache.js";
2
+ const DATATRACKER_URL = 'https://datatracker.ietf.org/api/v1/doc/document/';
3
+ const DEFAULT_LIMIT = 20;
4
+ export const rfcSearch = async (query, limit = DEFAULT_LIMIT) => {
5
+ const cacheKey = 'rfc:' + query;
6
+ const cached = await cache.get(cacheKey);
7
+ if (cached)
8
+ return cached.slice(0, limit);
9
+ const params = new URLSearchParams({
10
+ title__icontains: query,
11
+ type: 'rfc',
12
+ limit: String(Math.min(limit, 100)),
13
+ format: 'json',
14
+ });
15
+ const res = await fetch(DATATRACKER_URL + '?' + params);
16
+ if (!res.ok)
17
+ throw new Error('IETF Datatracker returned ' + res.status + ' ' + res.statusText);
18
+ const body = await res.json();
19
+ const results = [];
20
+ for (const doc of body.objects ?? []) {
21
+ const id = doc.name ?? '';
22
+ if (!id)
23
+ continue;
24
+ results.push({
25
+ id: id.toUpperCase(),
26
+ title: doc.title ?? '',
27
+ url: 'https://www.rfc-editor.org/rfc/' + id + '.html',
28
+ date: doc.time ?? '',
29
+ abstract: doc.abstract ?? '',
30
+ });
31
+ }
32
+ await cache.set(cacheKey, results);
33
+ return results.slice(0, limit);
34
+ };
35
+ //# sourceMappingURL=rfc-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rfc-search.js","sourceRoot":"","sources":["../../../src/providers/rfc-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AAEpC,MAAM,eAAe,GAAG,mDAAmD,CAAA;AAC3E,MAAM,aAAa,GAAG,EAAE,CAAA;AAiBxB,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,KAAa,EAAE,KAAK,GAAG,aAAa,EAAwB,EAAE;IAC5F,MAAM,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAA;IAE/B,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CAAc,QAAQ,CAAC,CAAA;IACrD,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IAEzC,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;QACjC,gBAAgB,EAAE,KAAK;QACvB,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACnC,MAAM,EAAE,MAAM;KACf,CAAC,CAAA;IAEF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,eAAe,GAAG,GAAG,GAAG,MAAM,CAAC,CAAA;IAEvD,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,CAAA;IAE9F,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAoC,CAAA;IAC/D,MAAM,OAAO,GAAgB,EAAE,CAAA;IAE/B,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;QACrC,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,IAAI,EAAE,CAAA;QACzB,IAAI,CAAC,EAAE;YAAE,SAAQ;QAEjB,OAAO,CAAC,IAAI,CAAC;YACX,EAAE,EAAE,EAAE,CAAC,WAAW,EAAE;YACpB,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE;YACtB,GAAG,EAAE,iCAAiC,GAAG,EAAE,GAAG,OAAO;YACrD,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE;YACpB,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE;SAC7B,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAElC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AAChC,CAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ export type W3cResult = {
2
+ title: string;
3
+ url: string;
4
+ };
5
+ export declare const w3cSearch: (query: string, limit?: number) => Promise<W3cResult[]>;
6
+ //# sourceMappingURL=w3c-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"w3c-search.d.ts","sourceRoot":"","sources":["../../../src/providers/w3c-search.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAsBD,eAAO,MAAM,SAAS,GAAU,OAAO,MAAM,EAAE,cAAqB,KAAG,OAAO,CAAC,SAAS,EAAE,CAgCzF,CAAA"}
@@ -0,0 +1,42 @@
1
+ import * as cache from "../cache.js";
2
+ // The W3C API accepts a `q` parameter and ignores it: 'css' and a nonsense string both return all
3
+ // 1713 specifications.
4
+ // So the whole list is fetched and filtered here, 1000 per page.
5
+ const API_URL = 'https://api.w3.org/specifications';
6
+ const PAGE_SIZE = 1000;
7
+ const DEFAULT_LIMIT = 20;
8
+ const fetchPage = async (page) => {
9
+ const params = new URLSearchParams({ items: String(PAGE_SIZE), page: String(page) });
10
+ const res = await fetch(API_URL + '?' + params);
11
+ if (!res.ok)
12
+ throw new Error('W3C API returned ' + res.status + ' ' + res.statusText);
13
+ return await res.json();
14
+ };
15
+ export const w3cSearch = async (query, limit = DEFAULT_LIMIT) => {
16
+ const cacheKey = 'w3c:' + query;
17
+ const cached = await cache.get(cacheKey);
18
+ if (cached)
19
+ return cached.slice(0, limit);
20
+ const first = await fetchPage(1);
21
+ const specs = [...first._links?.specifications ?? []];
22
+ // `pages` counts pages at the requested size, so a second fetch covers the rest at 1000 each.
23
+ const total = first.pages ?? 1;
24
+ for (let page = 2; page <= total; page++) {
25
+ const next = await fetchPage(page);
26
+ specs.push(...next._links?.specifications ?? []);
27
+ }
28
+ const needle = query.toLowerCase();
29
+ const results = [];
30
+ for (const spec of specs) {
31
+ const title = spec.title ?? '';
32
+ const url = spec.shortlink ?? spec.href ?? '';
33
+ if (!title || !url)
34
+ continue;
35
+ if (!title.toLowerCase().includes(needle))
36
+ continue;
37
+ results.push({ title, url });
38
+ }
39
+ await cache.set(cacheKey, results);
40
+ return results.slice(0, limit);
41
+ };
42
+ //# sourceMappingURL=w3c-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"w3c-search.js","sourceRoot":"","sources":["../../../src/providers/w3c-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AAEpC,kGAAkG;AAClG,uBAAuB;AACvB,iEAAiE;AACjE,MAAM,OAAO,GAAG,mCAAmC,CAAA;AACnD,MAAM,SAAS,GAAG,IA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AAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,cAAc,IAAI,EAAE,CAAC,CAAA;IAClD,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;IAClC,MAAM,OAAO,GAAgB,EAAE,CAAA;IAE/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAA;QAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAA;QAE7C,IAAI,CAAC,KAAK,IAAI,CAAC,GAAG;YAAE,SAAQ;QAC5B,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,SAAQ;QAEnD,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;IAC9B,CAAC;IAED,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAElC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AAChC,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ export type WhatwgResult = {
2
+ title: string;
3
+ url: string;
4
+ abstract: string;
5
+ workstream: string;
6
+ };
7
+ export declare const whatwgSearch: (query: string, limit?: number) => Promise<WhatwgResult[]>;
8
+ //# sourceMappingURL=whatwg-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatwg-search.d.ts","sourceRoot":"","sources":["../../../src/providers/whatwg-search.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAaD,eAAO,MAAM,YAAY,GAAU,OAAO,MAAM,EAAE,cAAqB,KAAG,OAAO,CAAC,YAAY,EAAE,CA8B/F,CAAA"}
@@ -0,0 +1,31 @@
1
+ import * as cache from "../cache.js";
2
+ // WHATWG publishes its whole standards index as one small JSON file, and offers no search endpoint.
3
+ const DB_URL = 'https://raw.githubusercontent.com/whatwg/sg/main/db.json';
4
+ const DEFAULT_LIMIT = 20;
5
+ export const whatwgSearch = async (query, limit = DEFAULT_LIMIT) => {
6
+ const cacheKey = 'whatwg:' + query;
7
+ const cached = await cache.get(cacheKey);
8
+ if (cached)
9
+ return cached.slice(0, limit);
10
+ const res = await fetch(DB_URL);
11
+ if (!res.ok)
12
+ throw new Error('WHATWG index returned ' + res.status + ' ' + res.statusText);
13
+ const body = await res.json();
14
+ const needle = query.toLowerCase();
15
+ const results = [];
16
+ for (const workstream of body.workstreams ?? []) {
17
+ for (const standard of workstream.standards ?? []) {
18
+ const title = standard.name ?? '';
19
+ const url = standard.href ?? '';
20
+ const abstract = standard.description ?? '';
21
+ if (!title || !url)
22
+ continue;
23
+ if (!(title + ' ' + abstract).toLowerCase().includes(needle))
24
+ continue;
25
+ results.push({ title, url, abstract, workstream: workstream.name ?? '' });
26
+ }
27
+ }
28
+ await cache.set(cacheKey, results);
29
+ return results.slice(0, limit);
30
+ };
31
+ //# sourceMappingURL=whatwg-search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatwg-search.js","sourceRoot":"","sources":["../../../src/providers/whatwg-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AAEpC,oGAAoG;AACpG,MAAM,MAAM,GAAG,0DAA0D,CAAA;AACzE,MAAM,aAAa,GAAG,EAAE,CAAA;AAoBxB,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,KAAa,EAAE,KAAK,GAAG,aAAa,EAA2B,EAAE;IAClG,MAAM,QAAQ,GAAG,SAAS,GAAG,KAAK,CAAA;IAElC,MAAM,MAAM,GAAG,MAA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AAA;IAElC,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AAChC,CAAC,CAAA"}
@@ -2,6 +2,9 @@ import type { BskyPost } from './providers/bsky-search.ts';
2
2
  import type { DdgResult } from './providers/ddg-search.ts';
3
3
  import type { GnewsResult } from './providers/gnews-search.ts';
4
4
  import type { MdnDocument } from './providers/mdn-search.ts';
5
+ import type { RfcResult } from './providers/rfc-search.ts';
6
+ import type { W3cResult } from './providers/w3c-search.ts';
7
+ import type { WhatwgResult } from './providers/whatwg-search.ts';
5
8
  import type { WikiPage } from './providers/wiki-search.ts';
6
9
  export declare const renderDdgResult: (result: DdgResult, index: number) => string;
7
10
  export declare const renderWebResult: (result: DdgResult, index: number) => string;
@@ -9,4 +12,7 @@ export declare const renderGnewsItem: (result: GnewsResult, index: number) => st
9
12
  export declare const renderBskyPost: (post: BskyPost, index: number) => string;
10
13
  export declare const renderWikiPage: (page: WikiPage, index: number) => string;
11
14
  export declare const renderMdnDoc: (doc: MdnDocument, index: number) => string;
15
+ export declare const renderRfc: (result: RfcResult, index: number) => string;
16
+ export declare const renderW3c: (result: W3cResult, index: number) => string;
17
+ export declare const renderWhatwg: (result: WhatwgResult, index: number) => string;
12
18
  //# sourceMappingURL=renderers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderers.d.ts","sourceRoot":"","sources":["../../src/renderers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE1D,eAAO,MAAM,eAAe,GAAI,QAAQ,SAAS,EAAE,OAAO,MAA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AM,KAAG,MAI9D,CAAA;AAGD,eAAO,MAAM,cAAc,GAAI,MAAM,QAAQ,EAAE,OAAO,MAAM,KAAG,MAK9D,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,KAAK,WAAW,EAAE,OAAO,MAAM,KAAG,MAI9D,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,QAAQ,SAAS,EAAE,OAAO,MAAM,KAAG,MAI5D,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,QAAQ,SAAS,EAAE,OAAO,MAAM,KAAG,MAG5D,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,QAAQ,YAAY,EAAE,OAAO,MAAM,KAAG,MAIlE,CAAA"}
@@ -26,4 +26,18 @@ export const renderMdnDoc = (doc, index) => {
26
26
  https://developer.mozilla.org${doc.mdn_url}
27
27
  ${normalizeBlurb(doc.summary)}`;
28
28
  };
29
+ export const renderRfc = (result, index) => {
30
+ return `${index + 1}. ${result.id} — ${result.title}
31
+ ${result.url}
32
+ ${normalizeBlurb(result.abstract)}`;
33
+ };
34
+ export const renderW3c = (result, index) => {
35
+ return `${index + 1}. ${result.title}
36
+ ${result.url}`;
37
+ };
38
+ export const renderWhatwg = (result, index) => {
39
+ return `${index + 1}. ${result.title}
40
+ ${result.url}
41
+ ${normalizeBlurb(result.abstract)}`;
42
+ };
29
43
  //# sourceMappingURL=renderers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderers.js","sourceRoot":"","sources":["../../src/renderers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAOrD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAiB,EAAE,KAAa,EAAU,EAAE;IAC1E,OAAO,GAAG,KAAK,GAAG,CAAC,KAAK,MAAM,CAAC,KAAK;KACjC,MAAM,CAAC,GAAG;KACV,cAAc,CAAC,MAAM,CAAC,QAAQ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M,CAAC,KAAK;KACjC,MAAM,CAAC,GAAG;KACV,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;AACtC,CAAC,CAAA"}
@@ -6,5 +6,8 @@ export declare const createBskySearchTool: (context: Plugin.Context) => Tool.Inf
6
6
  export declare const createWikiSearchTool: (context: Plugin.Context) => Tool.Info;
7
7
  export declare const createGnewsSearchTool: (context: Plugin.Context) => Tool.Info;
8
8
  export declare const createMdnSearchTool: (context: Plugin.Context) => Tool.Info;
9
+ export declare const createRfcSearchTool: (context: Plugin.Context) => Tool.Info;
10
+ export declare const createW3cSearchTool: (context: Plugin.Context) => Tool.Info;
11
+ export declare const createWhatwgSearchTool: (context: Plugin.Context) => Tool.Info;
9
12
  export declare const createSearchTools: (context: Plugin.Context) => Tool.Info[];
10
13
  //# sourceMappingURL=search.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,KAAK,IAAI,MAAM,+BAA+B,CAAA;AAwD1D,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAqBjE,CAAA;AAEF,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAqBnE,CAAA;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAwClE,CAAA;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAmClE,CAAA;AAEF,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CAAC,IAkCnE,CAAA;AAEF,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,CAAC,OAAO,KAAG,IAAI,CA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
5
5
  import { ddgSearch } from "./providers/ddg-search.js";
6
6
  import { gnewsSearch } from "./providers/gnews-search.js";
7
7
  import { mdnSearch } from "./providers/mdn-search.js";
8
+ import { rfcSearch } from "./providers/rfc-search.js";
9
+ import { w3cSearch } from "./providers/w3c-search.js";
10
+ import { whatwgSearch } from "./providers/whatwg-search.js";
8
11
  import { wikiSearch } from "./providers/wiki-search.js";
9
- import { renderBskyPost, renderDdgResult, renderGnewsItem, renderMdnDoc, renderWebResult, renderWikiPage, } from "./renderers.js";
12
+ import { renderBskyPost, renderDdgResult, renderGnewsItem, renderMdnDoc, renderRfc, renderW3c, renderWhatwg, renderWebResult, renderWikiPage, } from "./renderers.js";
10
13
  import { safeAsync } from "./safe.js";
11
14
  const postResult = async (context, ctx, text) => {
12
15
  await safeAsync(() => sendResult({ context, sessionID: ctx.sessionID, text }));
@@ -203,12 +206,99 @@ export const createMdnSearchTool = (context) => ({
203
206
  return textOutput(formatted);
204
207
  },
205
208
  });
209
+ export const createRfcSearchTool = (context) => ({
210
+ name: 'rfc_search',
211
+ description: 'Search IETF RFCs by title. Returns RFC number, title, date, and abstract.',
212
+ input: {
213
+ type: 'object',
214
+ properties: {
215
+ query: { type: 'string', description: 'The search query' },
216
+ limit: { type: 'number', description: 'Maximum number of results to return (default 20)' },
217
+ },
218
+ required: ['query'],
219
+ additionalProperties: false,
220
+ },
221
+ async execute(input, ctx) {
222
+ const query = stringField(input, 'query');
223
+ const limit = numberField(input, 'limit');
224
+ const { data, error } = await safeAsync(() => rfcSearch(query, limit));
225
+ if (error)
226
+ return textOutput('RFC search failed: ' + error.message);
227
+ const formatted = formatResults({
228
+ label: 'RFC results',
229
+ items: data,
230
+ total: data.length,
231
+ renderItem: renderRfc,
232
+ });
233
+ await postResult(context, ctx, formatted);
234
+ return textOutput(formatted);
235
+ },
236
+ });
237
+ export const createW3cSearchTool = (context) => ({
238
+ name: 'w3c_search',
239
+ description: 'Search W3C specifications by title. Returns the spec title and its URL.',
240
+ input: {
241
+ type: 'object',
242
+ properties: {
243
+ query: { type: 'string', description: 'The search query' },
244
+ limit: { type: 'number', description: 'Maximum number of results to return (default 20)' },
245
+ },
246
+ required: ['query'],
247
+ additionalProperties: false,
248
+ },
249
+ async execute(input, ctx) {
250
+ const query = stringField(input, 'query');
251
+ const limit = numberField(input, 'limit');
252
+ const { data, error } = await safeAsync(() => w3cSearch(query, limit));
253
+ if (error)
254
+ return textOutput('W3C search failed: ' + error.message);
255
+ const formatted = formatResults({
256
+ label: 'W3C results',
257
+ items: data,
258
+ total: data.length,
259
+ renderItem: renderW3c,
260
+ });
261
+ await postResult(context, ctx, formatted);
262
+ return textOutput(formatted);
263
+ },
264
+ });
265
+ export const createWhatwgSearchTool = (context) => ({
266
+ name: 'whatwg_search',
267
+ description: 'Search WHATWG living standards. Returns the standard name, URL, and description.',
268
+ input: {
269
+ type: 'object',
270
+ properties: {
271
+ query: { type: 'string', description: 'The search query' },
272
+ limit: { type: 'number', description: 'Maximum number of results to return (default 20)' },
273
+ },
274
+ required: ['query'],
275
+ additionalProperties: false,
276
+ },
277
+ async execute(input, ctx) {
278
+ const query = stringField(input, 'query');
279
+ const limit = numberField(input, 'limit');
280
+ const { data, error } = await safeAsync(() => whatwgSearch(query, limit));
281
+ if (error)
282
+ return textOutput('WHATWG search failed: ' + error.message);
283
+ const formatted = formatResults({
284
+ label: 'WHATWG results',
285
+ items: data,
286
+ total: data.length,
287
+ renderItem: renderWhatwg,
288
+ });
289
+ await postResult(context, ctx, formatted);
290
+ return textOutput(formatted);
291
+ },
292
+ });
206
293
  export const createSearchTools = (context) => [
207
294
  createBraveSearchTool(context),
208
295
  createBskySearchTool(context),
209
296
  createDdgSearchTool(context),
210
297
  createGnewsSearchTool(context),
211
298
  createMdnSearchTool(context),
299
+ createRfcSearchTool(context),
300
+ createW3cSearchTool(context),
301
+ createWhatwgSearchTool(context),
212
302
  createWikiSearchTool(context),
213
303
  ];
214
304
  //# sourceMappingURL=search.js.map
@@ -1 +1 @@
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CAAC,CAAA;QAEtE,MAAM,SAAS,GAAG,aAAa,CAAC;YAC9B,KAAK,EAAE,gBAAgB;YACvB,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,IAAI,CAAC,MAAM;YAClB,UAAU,EAAE,YAAY;SACzB,CAAC,CAAA;QAEF,MAAM,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,CAAC,CAAA;QAEzC,OAAO,UAAU,CAAC,SAAS,CAAC,CAAA;IAC9B,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAuB,EAAe,EAAE,CAAC;IACzE,qBAAqB,CAAC,OAAO,CAAC;IAC9B,oBAAoB,CAAC,OAAO,CAAC;IAC7B,mBAAmB,CAAC,OAAO,CAAC;IAC5B,qBAAqB,CAAC,OAAO,CAAC;IAC9B,mBAAmB,CAAC,OAAO,CAAC;IAC5B,mBAAmB,CAAC,OAAO,CAAC;IAC5B,mBAAmB,CAAC,OAAO,CAAC;IAC5B,sBAAsB,CAAC,OAAO,CAAC;IAC/B,oBAAoB,CAAC,OAAO,CAAC;CAC9B,CAAA"}
package/package.json CHANGED
@@ -1,20 +1,25 @@
1
1
  {
2
2
  "name": "opencode-search",
3
- "version": "1.0.0-next.8",
4
- "description": "OpenCode plugin that provides web search tools using DuckDuckGo, Brave, Google News, Wikipedia, Bluesky, and MDN Web Docs.",
3
+ "version": "1.0.0-next.9",
4
+ "description": "OpenCode plugin that provides web search tools using DuckDuckGo, Brave, Google News, Wikipedia, Bluesky, MDN Web Docs, and the IETF, W3C and WHATWG specifications.",
5
5
  "keywords": [
6
+ "atproto",
7
+ "bluesky",
8
+ "brave",
9
+ "duckduckgo",
10
+ "google-news",
11
+ "ietf",
12
+ "mdn",
6
13
  "opencode",
7
14
  "opencode-plugin",
8
15
  "plugin",
16
+ "rfc",
9
17
  "search",
18
+ "specifications",
19
+ "w3c",
10
20
  "web-search",
11
- "duckduckgo",
12
- "brave",
13
- "google-news",
14
- "wikipedia",
15
- "mdn",
16
- "bluesky",
17
- "atproto"
21
+ "whatwg",
22
+ "wikipedia"
18
23
  ],
19
24
  "homepage": "https://github.com/whaaaley/opencode-search#readme",
20
25
  "bugs": {
@@ -0,0 +1,22 @@
1
+ import { describe, expect, it } from 'bun:test'
2
+ import { rfcSearch } from './rfc-search.ts'
3
+
4
+ describe('rfcSearch', () => {
5
+ it('returns RFCs matching a title query', async () => {
6
+ const results = await rfcSearch('HTTP Semantics')
7
+
8
+ expect(results.length).toBeGreaterThan(0)
9
+
10
+ const first = results[0]
11
+ if (!first) throw new Error('Expected at least one RFC')
12
+
13
+ expect(first.id).toMatch(/^RFC\d+$/)
14
+ expect(first.url).toStartWith('https://www.rfc-editor.org/rfc/')
15
+ })
16
+
17
+ it('respects the limit', async () => {
18
+ const results = await rfcSearch('HTTP', 3)
19
+
20
+ expect(results.length).toBeLessThanOrEqual(3)
21
+ })
22
+ })
@@ -0,0 +1,57 @@
1
+ import * as cache from '../cache.ts'
2
+
3
+ const DATATRACKER_URL = 'https://datatracker.ietf.org/api/v1/doc/document/'
4
+ const DEFAULT_LIMIT = 20
5
+
6
+ export type RfcResult = {
7
+ id: string
8
+ title: string
9
+ url: string
10
+ date: string
11
+ abstract: string
12
+ }
13
+
14
+ type DatatrackerDoc = {
15
+ name?: string
16
+ title?: string
17
+ time?: string
18
+ abstract?: string
19
+ }
20
+
21
+ export const rfcSearch = async (query: string, limit = DEFAULT_LIMIT): Promise<RfcResult[]> => {
22
+ const cacheKey = 'rfc:' + query
23
+
24
+ const cached = await cache.get<RfcResult[]>(cacheKey)
25
+ if (cached) return cached.slice(0, limit)
26
+
27
+ const params = new URLSearchParams({
28
+ title__icontains: query,
29
+ type: 'rfc',
30
+ limit: String(Math.min(limit, 100)),
31
+ format: 'json',
32
+ })
33
+
34
+ const res = await fetch(DATATRACKER_URL + '?' + params)
35
+
36
+ if (!res.ok) throw new Error('IETF Datatracker returned ' + res.status + ' ' + res.statusText)
37
+
38
+ const body = await res.json() as { objects?: DatatrackerDoc[] }
39
+ const results: RfcResult[] = []
40
+
41
+ for (const doc of body.objects ?? []) {
42
+ const id = doc.name ?? ''
43
+ if (!id) continue
44
+
45
+ results.push({
46
+ id: id.toUpperCase(),
47
+ title: doc.title ?? '',
48
+ url: 'https://www.rfc-editor.org/rfc/' + id + '.html',
49
+ date: doc.time ?? '',
50
+ abstract: doc.abstract ?? '',
51
+ })
52
+ }
53
+
54
+ await cache.set(cacheKey, results)
55
+
56
+ return results.slice(0, limit)
57
+ }
@@ -0,0 +1,22 @@
1
+ import { describe, expect, it } from 'bun:test'
2
+ import { w3cSearch } from './w3c-search.ts'
3
+
4
+ describe('w3cSearch', () => {
5
+ it('filters specifications by title', async () => {
6
+ const results = await w3cSearch('CSS')
7
+
8
+ expect(results.length).toBeGreaterThan(0)
9
+
10
+ const first = results[0]
11
+ if (!first) throw new Error('Expected at least one specification')
12
+
13
+ expect(first.title.toLowerCase()).toContain('css')
14
+ expect(first.url).toStartWith('http')
15
+ })
16
+
17
+ it('respects the limit', async () => {
18
+ const results = await w3cSearch('CSS', 5)
19
+
20
+ expect(results.length).toBeLessThanOrEqual(5)
21
+ })
22
+ })
@@ -0,0 +1,67 @@
1
+ import * as cache from '../cache.ts'
2
+
3
+ // The W3C API accepts a `q` parameter and ignores it: 'css' and a nonsense string both return all
4
+ // 1713 specifications.
5
+ // So the whole list is fetched and filtered here, 1000 per page.
6
+ const API_URL = 'https://api.w3.org/specifications'
7
+ const PAGE_SIZE = 1000
8
+ const DEFAULT_LIMIT = 20
9
+
10
+ export type W3cResult = {
11
+ title: string
12
+ url: string
13
+ }
14
+
15
+ type Spec = {
16
+ title?: string
17
+ href?: string
18
+ 'shortlink'?: string
19
+ }
20
+
21
+ type Page = {
22
+ pages?: number
23
+ _links?: { specifications?: Spec[] }
24
+ }
25
+
26
+ const fetchPage = async (page: number): Promise<Page> => {
27
+ const params = new URLSearchParams({ items: String(PAGE_SIZE), page: String(page) })
28
+ const res = await fetch(API_URL + '?' + params)
29
+
30
+ if (!res.ok) throw new Error('W3C API returned ' + res.status + ' ' + res.statusText)
31
+
32
+ return await res.json() as Page
33
+ }
34
+
35
+ export const w3cSearch = async (query: string, limit = DEFAULT_LIMIT): Promise<W3cResult[]> => {
36
+ const cacheKey = 'w3c:' + query
37
+
38
+ const cached = await cache.get<W3cResult[]>(cacheKey)
39
+ if (cached) return cached.slice(0, limit)
40
+
41
+ const first = await fetchPage(1)
42
+ const specs = [...first._links?.specifications ?? []]
43
+
44
+ // `pages` counts pages at the requested size, so a second fetch covers the rest at 1000 each.
45
+ const total = first.pages ?? 1
46
+ for (let page = 2; page <= total; page++) {
47
+ const next = await fetchPage(page)
48
+ specs.push(...next._links?.specifications ?? [])
49
+ }
50
+
51
+ const needle = query.toLowerCase()
52
+ const results: W3cResult[] = []
53
+
54
+ for (const spec of specs) {
55
+ const title = spec.title ?? ''
56
+ const url = spec.shortlink ?? spec.href ?? ''
57
+
58
+ if (!title || !url) continue
59
+ if (!title.toLowerCase().includes(needle)) continue
60
+
61
+ results.push({ title, url })
62
+ }
63
+
64
+ await cache.set(cacheKey, results)
65
+
66
+ return results.slice(0, limit)
67
+ }
@@ -0,0 +1,21 @@
1
+ import { describe, expect, it } from 'bun:test'
2
+ import { whatwgSearch } from './whatwg-search.ts'
3
+
4
+ describe('whatwgSearch', () => {
5
+ it('finds a living standard by name', async () => {
6
+ const results = await whatwgSearch('HTML')
7
+
8
+ expect(results.length).toBeGreaterThan(0)
9
+
10
+ const first = results[0]
11
+ if (!first) throw new Error('Expected at least one standard')
12
+
13
+ expect(first.url).toContain('spec.whatwg.org')
14
+ })
15
+
16
+ it('returns nothing for a query that matches no standard', async () => {
17
+ const results = await whatwgSearch('zzzznotastandard')
18
+
19
+ expect(results.length).toEqual(0)
20
+ })
21
+ })
@@ -0,0 +1,55 @@
1
+ import * as cache from '../cache.ts'
2
+
3
+ // WHATWG publishes its whole standards index as one small JSON file, and offers no search endpoint.
4
+ const DB_URL = 'https://raw.githubusercontent.com/whatwg/sg/main/db.json'
5
+ const DEFAULT_LIMIT = 20
6
+
7
+ export type WhatwgResult = {
8
+ title: string
9
+ url: string
10
+ abstract: string
11
+ workstream: string
12
+ }
13
+
14
+ type Standard = {
15
+ name?: string
16
+ href?: string
17
+ description?: string
18
+ }
19
+
20
+ type Workstream = {
21
+ name?: string
22
+ standards?: Standard[]
23
+ }
24
+
25
+ export const whatwgSearch = async (query: string, limit = DEFAULT_LIMIT): Promise<WhatwgResult[]> => {
26
+ const cacheKey = 'whatwg:' + query
27
+
28
+ const cached = await cache.get<WhatwgResult[]>(cacheKey)
29
+ if (cached) return cached.slice(0, limit)
30
+
31
+ const res = await fetch(DB_URL)
32
+
33
+ if (!res.ok) throw new Error('WHATWG index returned ' + res.status + ' ' + res.statusText)
34
+
35
+ const body = await res.json() as { workstreams?: Workstream[] }
36
+ const needle = query.toLowerCase()
37
+ const results: WhatwgResult[] = []
38
+
39
+ for (const workstream of body.workstreams ?? []) {
40
+ for (const standard of workstream.standards ?? []) {
41
+ const title = standard.name ?? ''
42
+ const url = standard.href ?? ''
43
+ const abstract = standard.description ?? ''
44
+
45
+ if (!title || !url) continue
46
+ if (!(title + ' ' + abstract).toLowerCase().includes(needle)) continue
47
+
48
+ results.push({ title, url, abstract, workstream: workstream.name ?? '' })
49
+ }
50
+ }
51
+
52
+ await cache.set(cacheKey, results)
53
+
54
+ return results.slice(0, limit)
55
+ }
package/src/renderers.ts CHANGED
@@ -4,6 +4,9 @@ import type { BskyPost } from './providers/bsky-search.ts'
4
4
  import type { DdgResult } from './providers/ddg-search.ts'
5
5
  import type { GnewsResult } from './providers/gnews-search.ts'
6
6
  import type { MdnDocument } from './providers/mdn-search.ts'
7
+ import type { RfcResult } from './providers/rfc-search.ts'
8
+ import type { W3cResult } from './providers/w3c-search.ts'
9
+ import type { WhatwgResult } from './providers/whatwg-search.ts'
7
10
  import type { WikiPage } from './providers/wiki-search.ts'
8
11
 
9
12
  export const renderDdgResult = (result: DdgResult, index: number): string => {
@@ -40,3 +43,20 @@ export const renderMdnDoc = (doc: MdnDocument, index: number): string => {
40
43
  https://developer.mozilla.org${doc.mdn_url}
41
44
  ${normalizeBlurb(doc.summary)}`
42
45
  }
46
+
47
+ export const renderRfc = (result: RfcResult, index: number): string => {
48
+ return `${index + 1}. ${result.id} — ${result.title}
49
+ ${result.url}
50
+ ${normalizeBlurb(result.abstract)}`
51
+ }
52
+
53
+ export const renderW3c = (result: W3cResult, index: number): string => {
54
+ return `${index + 1}. ${result.title}
55
+ ${result.url}`
56
+ }
57
+
58
+ export const renderWhatwg = (result: WhatwgResult, index: number): string => {
59
+ return `${index + 1}. ${result.title}
60
+ ${result.url}
61
+ ${normalizeBlurb(result.abstract)}`
62
+ }
package/src/search.ts CHANGED
@@ -7,12 +7,18 @@ import { bskySearch } from './providers/bsky-search.ts'
7
7
  import { ddgSearch } from './providers/ddg-search.ts'
8
8
  import { gnewsSearch } from './providers/gnews-search.ts'
9
9
  import { mdnSearch } from './providers/mdn-search.ts'
10
+ import { rfcSearch } from './providers/rfc-search.ts'
11
+ import { w3cSearch } from './providers/w3c-search.ts'
12
+ import { whatwgSearch } from './providers/whatwg-search.ts'
10
13
  import { wikiSearch } from './providers/wiki-search.ts'
11
14
  import {
12
15
  renderBskyPost,
13
16
  renderDdgResult,
14
17
  renderGnewsItem,
15
18
  renderMdnDoc,
19
+ renderRfc,
20
+ renderW3c,
21
+ renderWhatwg,
16
22
  renderWebResult,
17
23
  renderWikiPage,
18
24
  } from './renderers.ts'
@@ -254,11 +260,110 @@ export const createMdnSearchTool = (context: Plugin.Context): Tool.Info => ({
254
260
  },
255
261
  })
256
262
 
263
+ export const createRfcSearchTool = (context: Plugin.Context): Tool.Info => ({
264
+ name: 'rfc_search',
265
+ description: 'Search IETF RFCs by title. Returns RFC number, title, date, and abstract.',
266
+ input: {
267
+ type: 'object',
268
+ properties: {
269
+ query: { type: 'string', description: 'The search query' },
270
+ limit: { type: 'number', description: 'Maximum number of results to return (default 20)' },
271
+ },
272
+ required: ['query'],
273
+ additionalProperties: false,
274
+ },
275
+ async execute(input, ctx) {
276
+ const query = stringField(input, 'query')
277
+ const limit = numberField(input, 'limit')
278
+
279
+ const { data, error } = await safeAsync(() => rfcSearch(query, limit))
280
+ if (error) return textOutput('RFC search failed: ' + error.message)
281
+
282
+ const formatted = formatResults({
283
+ label: 'RFC results',
284
+ items: data,
285
+ total: data.length,
286
+ renderItem: renderRfc,
287
+ })
288
+
289
+ await postResult(context, ctx, formatted)
290
+
291
+ return textOutput(formatted)
292
+ },
293
+ })
294
+
295
+ export const createW3cSearchTool = (context: Plugin.Context): Tool.Info => ({
296
+ name: 'w3c_search',
297
+ description: 'Search W3C specifications by title. Returns the spec title and its URL.',
298
+ input: {
299
+ type: 'object',
300
+ properties: {
301
+ query: { type: 'string', description: 'The search query' },
302
+ limit: { type: 'number', description: 'Maximum number of results to return (default 20)' },
303
+ },
304
+ required: ['query'],
305
+ additionalProperties: false,
306
+ },
307
+ async execute(input, ctx) {
308
+ const query = stringField(input, 'query')
309
+ const limit = numberField(input, 'limit')
310
+
311
+ const { data, error } = await safeAsync(() => w3cSearch(query, limit))
312
+ if (error) return textOutput('W3C search failed: ' + error.message)
313
+
314
+ const formatted = formatResults({
315
+ label: 'W3C results',
316
+ items: data,
317
+ total: data.length,
318
+ renderItem: renderW3c,
319
+ })
320
+
321
+ await postResult(context, ctx, formatted)
322
+
323
+ return textOutput(formatted)
324
+ },
325
+ })
326
+
327
+ export const createWhatwgSearchTool = (context: Plugin.Context): Tool.Info => ({
328
+ name: 'whatwg_search',
329
+ description: 'Search WHATWG living standards. Returns the standard name, URL, and description.',
330
+ input: {
331
+ type: 'object',
332
+ properties: {
333
+ query: { type: 'string', description: 'The search query' },
334
+ limit: { type: 'number', description: 'Maximum number of results to return (default 20)' },
335
+ },
336
+ required: ['query'],
337
+ additionalProperties: false,
338
+ },
339
+ async execute(input, ctx) {
340
+ const query = stringField(input, 'query')
341
+ const limit = numberField(input, 'limit')
342
+
343
+ const { data, error } = await safeAsync(() => whatwgSearch(query, limit))
344
+ if (error) return textOutput('WHATWG search failed: ' + error.message)
345
+
346
+ const formatted = formatResults({
347
+ label: 'WHATWG results',
348
+ items: data,
349
+ total: data.length,
350
+ renderItem: renderWhatwg,
351
+ })
352
+
353
+ await postResult(context, ctx, formatted)
354
+
355
+ return textOutput(formatted)
356
+ },
357
+ })
358
+
257
359
  export const createSearchTools = (context: Plugin.Context): Tool.Info[] => [
258
360
  createBraveSearchTool(context),
259
361
  createBskySearchTool(context),
260
362
  createDdgSearchTool(context),
261
363
  createGnewsSearchTool(context),
262
364
  createMdnSearchTool(context),
365
+ createRfcSearchTool(context),
366
+ createW3cSearchTool(context),
367
+ createWhatwgSearchTool(context),
263
368
  createWikiSearchTool(context),
264
369
  ]