You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: add extract tool for SerpApi Extract API calls - #76
Handle string false when selecting non-markdown text content
src/mcp_components/tools.py:324
With mode="compact" and params.include_markdown="false", this identity check selects text_content.markdown while forwarding the string unchanged to SerpApi. Markdown is disabled upstream, so the default selector filters out the page content instead of returning text_content. Recognize the API-style string as well as Boolean false, and add a regression case; the current tests cover only the Boolean value.
The file engines/extract.json isn’t included. Copilot marked “Ship Extract schema for source-based startup” as resolved, but no file was added. I checked the live Playground: it does list extract (131 engines there, 118 committed), so builds that regenerate engines/ will pick it up. That covers Docker, the release bundle and the hosted server.
Running from source (uv run src/server.py) or building with mcpb/build.py --no-rebuild-engines won’t have it.
In those setups, serpapi://engines/extract is missing, but both the README and the tool description point to it.
We return content twice by default:
Markdown is on by default, even in complete mode. With include_markdown: True, a complete scrape returns both the full text and the markdown, so the page content arrives roughly twice. That’s a lot of tokens for the default call ({"params": {"url": ...}}). Is that intended, or should the markdown default apply only in compact mode?
The file engines/extract.json isn’t included. Copilot marked “Ship Extract schema for source-based startup” as resolved, but no file was added. I checked the live Playground: it does list extract (131 engines there, 118 committed), so builds that regenerate engines/ will pick it up. That covers Docker, the release bundle and the hosted server.
Running from source (uv run src/server.py) or building with mcpb/build.py --no-rebuild-engines won’t have it. In those setups, serpapi://engines/extract is missing, but both the README and the tool description point to it.
IMO, engine files in Git are adding a lot of noise. We usually have a few engine schemas updated every week. I planned to remove those entirely and generate them on the fly (during the build or first-run phase). Also, planning to set up an automated weekly job that refreshes the engine schema on our deployed server.
Our hosted MCP and built bundles are not affected because they get the latest engine schemas built in CI, as you noted.
Agree that this affects local runs using the `uv run command; I will fix the need to have static engine schemas as a follow-up PR.
@strzibny What do you think? Should I try the cleanup now or merge this and create a follow-up PR?
We return content twice by default:
Markdown is on by default, even in complete mode. With include_markdown: True, a complete scrape returns both the full text and the markdown, so the page content arrives roughly twice. That’s a lot of tokens for the default call ({"params": {"url": ...}}). Is that intended, or should the markdown default apply only in compact mode?
Agree with the token usage part.
Since MCP will be used mostly by agents, I wanted the response to include the most helpful data for agents. text_content.full is unformatted plain text and doesn't convey the page structure well. This was the reasoning behind adding Markdown.
Removing it from being added by default in complete also sounds reasonable. What do you recommend?
If you plan a follow-up, then it's fine. I don't think there is an easy answer for Markdown, but ideally I would like us to do the same default for search and scrape API. Maybe it makes sense that both would be Markdown by default, on the other hand this is not true for the server. But this might not be an issue per se, MCP could default to Markdown for it's obvious use by agents.
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
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.
extracttool that calls the SerpApi Extract APITests done: