Repository navigation
web_search: Serply as an API key service - #6
Merged
Merged
Conversation
Google results over GET /v1/search with the X-Api-Key header. Country goes out as gl and Freshness as tbs=qdr:, the same values Serper offers. Serply stops at 10 results and its hl does not change them, so the row caps at 10 and does not take the language.
Without gl, Serply serves each request from whichever proxy region is
free, so results can change country between calls. req_serply now sends
gl=us when the Country dial is empty, and the dial's default row reads
United States (default) in place of a second US row.
Also pins the zero-balance reply, a 402 with
{"detail":"Insufficient prepaid credits"}, as QuotaExhausted, and
skips reply rows whose link is an opaque token rather than a URL.
googio
force-pushed
the
feat/serply-search
branch
from
October 17, 2026 22:17
5296871 to
8663d3c
Compare
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.
web_search: Serply as an API key service
Adds
serply-apito the search services catalogue, next toserper-api. agentty has a matching PR that moves its submodule to this commit and adds the id to its registry list, so this one needs to be merged first.Disclosure: I work with Serply.
What it does
Serply returns Google results as JSON (docs). The row is built the same way as Serper's:
GET https://api.serply.io/v1/search/?q=...&num=...with the key in thex-api-keyheader, so the key never appears in the URL.glthe request is served from whichever proxy region is free and the results can change country between calls, sogl=usis sent when the dial is empty. The dial is the shared list with "United States (default)" as its first row and no second US row; any other choice is sent asgl(lower case).tbs=qdr:h|d|w|m|y. These are the same values Serper offers.has_native_exclude, so-site:stays in the query text, as it does for Serper. Google honours it.results[], usinglink,titleanddescription. A 2xx reply withoutresultsis reported as unreadable.402and{"detail":"Insufficient prepaid credits"}, whichclassify_httpalready reports as quota exhausted.linkinstead of a URL. Rows whoselinkis nothttp(s)are dropped before counting.resultson a 200: Serply's Pagination guide says this also happens during transient upstream failures. No header or field tells it apart from a genuine "no results"; the documented advice is to retry. mcp-cpp reports it as no results and moves to the next service.Things that differ from Serper:
max_countis 10.numabove 10 returns the same page asnum=10.hldid not change the results, so the row leaveslanguageoff and does not claim it.autocorrectparameter.user-agent: mcp-cppheader is sent. Cloudflare in front of the API refuses some default client user-agents, so the request names itself.The builder comment marks this [L]: the exact URL the test pins,
?q=rust%20async&num=5&gl=nz&tbs=qdr%3Ad, returns 200 from the live API, andtbs=qdr:hnarrowed the results.Tests
tests/web_search_services_test.cpp:tbslist Serper uses;hl, cap of 10,gl=uswith no dials, no second US row) and the reply parser (a recorded result, and a reply withoutresults);linkis a token and does not count it;The full
mcp_testsrun passes (96 cases, 2269 assertions) with GCC 13, and the build has no warnings.