Skip to content

fix(mcp): return empty search results as successful collection instead of error (#414) - #562

Open
sparkysolutions10-pixel wants to merge 1 commit into
Divinity-Labs:mainfrom
sparkysolutions10-pixel:fix/mcp-empty-search-success-414
Open

sparkysolutions10-pixel wants to merge 1 commit into
Divinity-Labs:mainfrom
sparkysolutions10-pixel:fix/mcp-empty-search-success-414

Conversation

@sparkysolutions10-pixel

Copy link
Copy Markdown
Contributor

Summary

Closes #414

Returns empty search results as a successful collection response ({ resources: [], count: 0 }) instead of reporting it as an error (ERR_NO_RESULTS), distinguishing empty matches from actual service errors.

Changes

  • Empty Search Distinction: Updated bazaar_search handler in src/mcp/server.ts so zero-length match results return { resources: [], count: 0 } with successful status (isError: false / omitted).
  • Error Retention for Genuine Failures: Preserved structured error reporting for genuine failures (SSRF blocks, network errors, timeouts, malformed upstream status).
  • Documentation: Updated examples/mcp-server/README.md to document that empty searches yield { resources: [], count: 0 } rather than ERR_NO_RESULTS.

Tests

  • Added unit tests in tests/mcp.test.ts:
    • returns success with empty collection when bazaar_search finds no resources (#414)
    • returns success with empty collection when endpoint returns empty array (#414)
  • Verified all 11 MCP tests pass cleanly (npx vitest run tests/mcp.test.ts).

@sparkysolutions10-pixel
sparkysolutions10-pixel force-pushed the fix/mcp-empty-search-success-414 branch from cd30481 to af57a89 Compare October 19, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An empty result is reported as an error

1 participant