Skip to content

fix: safe JSON parsing across all tools#1

Open
dylanworrall wants to merge 4 commits intomainfrom
fix/safe-json-parsing
Open

fix: safe JSON parsing across all tools#1
dylanworrall wants to merge 4 commits intomainfrom
fix/safe-json-parsing

Conversation

@dylanworrall
Copy link
Owner

Summary

  • Wrap res.json() in try-catch across perplexity, scrape, reddit, and sources tools
  • Prevents "Unexpected end of JSON input" crashes when Perplexity/Firecrawl/Reddit APIs return malformed responses

Test plan

  • Call deep_research when Perplexity returns error HTML — should return error message not crash
  • Call scrape_site when Firecrawl returns empty body — should return error message not crash
  • Call search_reddit when Reddit API is down — should return error message not crash

🤖 Generated with Claude Code

gilfoyle and others added 4 commits March 7, 2026 12:58
Add soshi.manifest.json with client metadata, events, actions, and
router keywords for Soshi integration. Replace Phase 2 MCP server
placeholder with thin wrapper that re-exports Vercel AI SDK tools
over stdio transport.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- perplexity.ts: safe JSON parsing on Perplexity API responses
- scrape.ts: safe JSON parsing on Firecrawl API responses (3 places)
- reddit.ts: safe JSON parsing on Reddit API response
- sources.ts: safe JSON parsing on source fetch

Prevents crashes when external APIs return empty or malformed responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant