Skip to content

Add enhanced debugging to diagnose Gamma API connectivity issues#19

Open
berlinbra wants to merge 1 commit into
fix-archived-filterfrom
debug-gamma-api
Open

Add enhanced debugging to diagnose Gamma API connectivity issues#19
berlinbra wants to merge 1 commit into
fix-archived-filterfrom
debug-gamma-api

Conversation

@berlinbra
Copy link
Copy Markdown
Owner

This PR adds enhanced debugging to help diagnose why the Gamma API is failing and falling back to CLOB client with outdated data.

What this adds

1. API Connectivity Test on Startup

  • Tests if the Gamma API is reachable when the server starts
  • Shows a sample market if successful
  • Clear error messages if it fails

2. Enhanced Debug Logging

  • Logs response headers and status codes
  • Shows raw response content (first 500 chars) for debugging
  • Logs the first market returned as a sample
  • More detailed error messages for different failure types

3. Better Fallback Handling

  • Clear warning when falling back to CLOB client
  • Indicates that CLOB data may be outdated
  • Shows exactly why the Gamma API failed

How to use

  1. Switch to the debug-gamma-api branch

  2. Run the server: uv run src/polymarket_mcp/server.py

  3. Look for the startup connectivity test:

    [DEBUG] Testing Gamma API connectivity...
    [DEBUG] ✅ Gamma API is reachable! Status: 200
    

    Or error messages if it fails

  4. When calling list-markets, check the debug output to see:

    • What parameters are being sent
    • The API response status and headers
    • Raw response content
    • Whether it's falling back to CLOB

This should help identify whether the issue is:

  • Network connectivity/blocking
  • API authentication requirements
  • Response format changes
  • Rate limiting
  • Or something else

- Add detailed logging for API responses including headers and raw content
- Add connectivity test on startup to check if Gamma API is reachable  
- Improve error messages to show exactly why the API might be failing
- Add warning when falling back to CLOB client with outdated data
- Log sample market data when successfully fetching from API
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