feat: Add API discovery tool for endpoint guidance#52
Merged
Conversation
Turn 10+ inference requests hang due to accumulated message context exceeding the 60-second timeout. MiniMax API needs >60s for responses with large conversation history. The 60s timeout triggered expensive retry loops (60s + backoff × 3 attempts), accumulating to ~4 minutes total wait time before final abort. Increased timeout to 120s (2 minutes) to allow complex inference requests to complete without retrying. This matches typical LLM response times for large contexts and reduces wasted retry latency. Testing: Deployed to Connie VPS, service restarted. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…loudflare
When expose_port detects BYOK mode (returning localhost URLs) and Cloudflare
credentials are configured, it now automatically:
1. Generates a subdomain (api-{port}-{timestamp}.compintel.co)
2. Creates a DNS A record pointing to the origin IP
3. Configures Caddy reverse proxy for public HTTPS access
4. Returns the public HTTPS URL instead of localhost
This unblocks agents like Connie from publishing services publicly when running
in BYOK mode. The agent can now distribute APIs and services without needing to
learn publish_service as a separate tool.
Graceful fallback: If any step of the auto-publish process fails, expose_port
returns the localhost URL with an error message, preventing tool failures.
Added tests:
- expose_port returns localhost when no Cloudflare creds
- expose_port auto-publishes when in BYOK + Cloudflare config
- expose_port falls back to localhost if auto-publish fails
All tests passing (5/5 in publish-service.test.ts).
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Implements get_api_discovery() tool to help agents verify correct API endpoints and avoid repeated 404 errors due to using wrong endpoints. Includes comprehensive API registry with: - Polymarket: Dual API architecture (CLOB for trading vs Gamma for market data) - GitHub: REST API endpoints with rate limits and authentication - x402 Payment Protocol: Protocol specification and reference implementations Tool provides: - Service name lookup to detailed endpoint information - Rate limiting and authentication requirements - Implementation notes to avoid common pitfalls (e.g., CLOB vs Gamma) - Example curl commands for each endpoint This is a dynamic alternative to static discovery files, allowing agents to query API information at any time during execution rather than just at startup. Registered in agent tools system alongside web_search and github_search. All 1806 tests passing.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Addresses all 4 important items from code review: 1. Response structure consistency: - Added executedAt (ISO timestamp) to all responses - Added cacheHit boolean to track cache hits - Added service_name to identify queried service - Now consistent with web_search and github_search tools 2. Caching layer: - Added 24-hour TTL in-memory cache (copy of web_search pattern) - Reduces redundant lookups for same service - Marked cache hits in response metadata 3. Parameter validation: - Added explicit validation for missing/empty service_name - Proper error message with available services listed - Handles undefined gracefully instead of returning 'undefined' string 4. GitHub API documentation: - Enhanced rate limits section: specify per-search limits and per_page guidance - Added authentication guidance: personal access tokens recommended for production - Clarified pagination: default 30, max 100 per page - Added search filter examples to reduce result sets - Emphasized: always list_directory before get_file to avoid 404s All 1806 tests passing.
Owner
Author
Code Review Fixes Applied ✅All 4 important issues from code review have been addressed: 1. Response Structure ConsistencyAdded fields to match and pattern:
2. Caching Layer AddedImplemented 24-hour TTL in-memory cache (consistent with other discovery tools):
3. Parameter Validation Enhanced
4. GitHub API Documentation ImprovedEnhanced with production-ready guidance:
Test Results✅ All 1806 tests passing (0 failures, 6 skipped) Status: Ready for merge ✨ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
get_api_discovery()tool to help agents verify correct API endpoints and avoid repeated 404 errors from using wrong endpoints.What's New
Key Features
Design Rationale
This tool uses a dynamic approach (Option C from the discovery tool evaluation) rather than a static file:
Testing
✅ All 1806 tests passing (0 failures, 6 skipped)
✅ TypeScript compilation successful
✅ Tool registered in agent tools system
✅ Follows existing tool patterns (web_search, github_search)
Example Usage
🤖 Generated with Claude Code