@webjsdev/mcp 0.1.6 → 0.1.7

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/src/mcp-source.js CHANGED
@@ -153,6 +153,13 @@ export function listSources(deps, pkgFilter) {
153
153
  export async function grepSources(deps, query) {
154
154
  const q = String(query).toLowerCase();
155
155
  if (!q) return 'Provide a non-empty `query`.';
156
+ // No resolvable packages means NOTHING was searched. Returning "no matches"
157
+ // here would read as authoritative absence when the search never ran, which
158
+ // is the #837 dogfood failure: an odd/shimmed node_modules layout resolved
159
+ // zero roots, so a real symbol looked missing and the agent lost trust.
160
+ if (!deps.roots.length) {
161
+ return 'No @webjsdev/* source is resolvable here, so NOTHING was searched (run inside a webjs app or the monorepo). This is not the same as "not found".';
162
+ }
156
163
  /** @type {string[]} */
157
164
  const hits = [];
158
165
  let capped = false;
@@ -170,7 +177,10 @@ export async function grepSources(deps, query) {
170
177
  }
171
178
  }
172
179
  }
173
- if (!hits.length) return `No matches for "${query}" in the @webjsdev/* source.`;
180
+ // Disclose the SEARCHED scope on a no-match, so "no matches" reads as a
181
+ // comprehensive-search result the agent can trust, not a silent gap (#837).
182
+ const searched = deps.roots.map((r) => r.pkg).join(', ');
183
+ if (!hits.length) return `No matches for "${query}" in the searched @webjsdev/* source (${searched}).`;
174
184
  if (capped) hits.push(`... (truncated at ${MAX_HITS} matches; narrow the query or read a file with \`path\`)`);
175
185
  return hits.join('\n');
176
186
  }