@gotza02/sequential-thinking 2026.1.18 → 2026.1.20

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
@@ -31,7 +31,10 @@ Search the web using Brave or Exa APIs.
31
31
  - `provider` (enum, optional): 'brave', 'exa', or 'google'.
32
32
 
33
33
  **Configuration:**
34
- Requires `BRAVE_API_KEY` or `EXA_API_KEY` environment variables.
34
+ Requires one of the following environment variable sets:
35
+ - `BRAVE_API_KEY` (for Brave Search)
36
+ - `EXA_API_KEY` (for Exa Search)
37
+ - `GOOGLE_API_KEY` and `GOOGLE_CX` (for Google Custom Search)
35
38
 
36
39
  ### fetch
37
40
 
@@ -127,6 +130,11 @@ npm run build
127
130
  npm test
128
131
  ```
129
132
 
133
+ ## Recent Updates (v2026.1.20)
134
+
135
+ - **New Features**:
136
+ - Added support for **Google Custom Search** in the `web_search` tool. (Requires `GOOGLE_API_KEY` and `GOOGLE_CX`).
137
+
130
138
  ## Recent Updates (v2026.1.18)
131
139
 
132
140
  - **Bug Fixes**:
package/dist/graph.js CHANGED
@@ -78,14 +78,31 @@ export class ProjectKnowledgeGraph {
78
78
  }
79
79
  }
80
80
  async resolvePath(dir, relativePath) {
81
- const extensions = ['', '.ts', '.js', '.tsx', '.jsx', '.json', '/index.ts', '/index.js'];
82
81
  const absolutePath = path.resolve(dir, relativePath);
82
+ // 1. Try exact match
83
+ if (this.nodes.has(absolutePath)) {
84
+ return absolutePath;
85
+ }
86
+ // 2. Try appending extensions
87
+ const extensions = ['.ts', '.js', '.tsx', '.jsx', '.json', '/index.ts', '/index.js'];
83
88
  for (const ext of extensions) {
84
89
  const p = absolutePath + ext;
85
90
  if (this.nodes.has(p)) {
86
91
  return p;
87
92
  }
88
93
  }
94
+ // 3. Try handling .js -> .ts mapping (ESM style imports)
95
+ if (absolutePath.endsWith('.js')) {
96
+ const tsPath = absolutePath.replace(/\.js$/, '.ts');
97
+ if (this.nodes.has(tsPath))
98
+ return tsPath;
99
+ const tsxPath = absolutePath.replace(/\.js$/, '.tsx');
100
+ if (this.nodes.has(tsxPath))
101
+ return tsxPath;
102
+ const jsxPath = absolutePath.replace(/\.js$/, '.jsx');
103
+ if (this.nodes.has(jsxPath))
104
+ return jsxPath;
105
+ }
89
106
  return null;
90
107
  }
91
108
  getRelationships(filePath) {
@@ -43,4 +43,37 @@ describe('ProjectKnowledgeGraph', () => {
43
43
  expect(relationships?.imports).toContain('utils.ts');
44
44
  expect(relationships?.imports).not.toContain('oldUtils.ts');
45
45
  });
46
+ it('should resolve .js imports to .ts files', async () => {
47
+ const mockContentIndex = `import { something } from './lib.js';`;
48
+ fs.readdir.mockResolvedValue([
49
+ { name: 'index.ts', isDirectory: () => false },
50
+ { name: 'lib.ts', isDirectory: () => false }
51
+ ]);
52
+ fs.readFile.mockImplementation(async (filePath) => {
53
+ if (filePath.endsWith('index.ts'))
54
+ return mockContentIndex;
55
+ return '';
56
+ });
57
+ await graph.build('/app');
58
+ const relationships = graph.getRelationships('/app/index.ts');
59
+ // The output of getRelationships.imports is relative paths.
60
+ // If imports ./lib.js, and we have lib.ts, it should resolve to /app/lib.ts
61
+ // And path.relative('/app', '/app/lib.ts') is 'lib.ts'
62
+ expect(relationships?.imports).toContain('lib.ts');
63
+ });
64
+ it('should resolve .js imports to .jsx files', async () => {
65
+ const mockContentIndex = `import { Button } from './Button.js';`;
66
+ fs.readdir.mockResolvedValue([
67
+ { name: 'index.js', isDirectory: () => false },
68
+ { name: 'Button.jsx', isDirectory: () => false }
69
+ ]);
70
+ fs.readFile.mockImplementation(async (filePath) => {
71
+ if (filePath.endsWith('index.js'))
72
+ return mockContentIndex;
73
+ return '';
74
+ });
75
+ await graph.build('/app');
76
+ const relationships = graph.getRelationships('/app/index.js');
77
+ expect(relationships?.imports).toContain('Button.jsx');
78
+ });
46
79
  });
package/dist/index.js CHANGED
@@ -105,15 +105,17 @@ server.tool("web_search", "Search the web using Brave or Exa APIs (requires API
105
105
  provider: z.enum(['brave', 'exa', 'google']).optional().describe("Preferred search provider")
106
106
  }, async ({ query, provider }) => {
107
107
  try {
108
- // Priority: User Preference > Brave > Exa
108
+ // Priority: User Preference > Brave > Exa > Google
109
109
  let selectedProvider = provider;
110
110
  if (!selectedProvider) {
111
111
  if (process.env.BRAVE_API_KEY)
112
112
  selectedProvider = 'brave';
113
113
  else if (process.env.EXA_API_KEY)
114
114
  selectedProvider = 'exa';
115
+ else if (process.env.GOOGLE_API_KEY)
116
+ selectedProvider = 'google';
115
117
  else
116
- return { content: [{ type: "text", text: "Error: No search provider configured. Please set BRAVE_API_KEY or EXA_API_KEY." }], isError: true };
118
+ return { content: [{ type: "text", text: "Error: No search provider configured. Please set BRAVE_API_KEY, EXA_API_KEY, or GOOGLE_API_KEY." }], isError: true };
117
119
  }
118
120
  if (selectedProvider === 'brave') {
119
121
  if (!process.env.BRAVE_API_KEY)
@@ -142,6 +144,23 @@ server.tool("web_search", "Search the web using Brave or Exa APIs (requires API
142
144
  const data = await response.json();
143
145
  return { content: [{ type: "text", text: JSON.stringify(data.results || data, null, 2) }] };
144
146
  }
147
+ if (selectedProvider === 'google') {
148
+ if (!process.env.GOOGLE_API_KEY)
149
+ throw new Error("GOOGLE_API_KEY not found");
150
+ if (!process.env.GOOGLE_CX)
151
+ throw new Error("GOOGLE_CX (Search Engine ID) not found");
152
+ const response = await fetch(`https://www.googleapis.com/customsearch/v1?key=${process.env.GOOGLE_API_KEY}&cx=${process.env.GOOGLE_CX}&q=${encodeURIComponent(query)}&num=5`);
153
+ if (!response.ok)
154
+ throw new Error(`Google API error: ${response.statusText}`);
155
+ const data = await response.json();
156
+ // Extract relevant fields to keep output clean
157
+ const results = data.items?.map((item) => ({
158
+ title: item.title,
159
+ link: item.link,
160
+ snippet: item.snippet
161
+ })) || [];
162
+ return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }] };
163
+ }
145
164
  return { content: [{ type: "text", text: "Error: Unsupported or unconfigured provider." }], isError: true };
146
165
  }
147
166
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gotza02/sequential-thinking",
3
- "version": "2026.1.18",
3
+ "version": "2026.1.20",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -12,7 +12,7 @@
12
12
  "bugs": "https://github.com/modelcontextprotocol/servers/issues",
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "https://github.com/modelcontextprotocol/servers.git"
15
+ "url": "git+https://github.com/modelcontextprotocol/servers.git"
16
16
  },
17
17
  "type": "module",
18
18
  "bin": {
@@ -40,4 +40,4 @@
40
40
  "typescript": "^5.3.3",
41
41
  "vitest": "^2.1.8"
42
42
  }
43
- }
43
+ }