fourget_news_search
Search for news articles using the 4get meta search engine to find recent articles with titles, URLs, descriptions, dates, and thumbnails.
Instructions
Search for news articles using the 4get meta search engine. Returns recent news with titles, URLs, descriptions, publication dates, and thumbnails. Supports pagination via the 'npt' token.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| page_token | No | ||
| engine | No | Optional search engine override (maps to 4get "scraper" query parameter). | |
| extra_params | No |
Implementation Reference
- src/server.py:166-184 (handler)MCP tool handler for fourget_news_search, including registration decorator and function implementation that delegates to FourGetClient.news_search.@register_tool( name='fourget_news_search', description=( 'Search for news articles using the 4get meta search engine. Returns ' 'recent news with titles, URLs, descriptions, publication dates, and ' "thumbnails. Supports pagination via the 'npt' token." ), ) async def fourget_news_search( query: str, page_token: str | None = None, engine: EngineParam = None, extra_params: dict[str, Any] | None = None, ) -> dict[str, Any]: return await client.news_search( query=query, page_token=page_token, options=combine_options(engine, extra_params), )
- src/server.py:52-55 (schema)Pydantic schema type for the optional 'engine' parameter shared across search tools.EngineParam = Annotated[ SearchEngine | None, Field(description='Optional search engine override (maps to 4get "scraper" query parameter).'), ]
- src/server.py:95-111 (registration)Decorator factory that registers tools with the FastMCP server instance.def register_tool( *, name: str, description: str, ) -> Callable[ [Callable[..., Awaitable[dict[str, Any]]]], Callable[..., Awaitable[dict[str, Any]]] ]: def decorator( func: Callable[..., Awaitable[dict[str, Any]]], ) -> Callable[..., Awaitable[dict[str, Any]]]: return mcp.tool( name=name, description=description, annotations={'readOnlyHint': True, 'idempotentHint': True}, )(func) return decorator
- src/client.py:143-173 (helper)FourGetClient method that handles the news search API call, delegating to shared _call_search logic.async def news_search( self, query: str, *, page_token: str | None = None, options: Mapping[str, Any] | None = None, ) -> dict[str, Any]: """Search for news articles using the 4get API. Args: query: News search query. Ignored when using page_token. page_token: Pagination token from previous response's 'npt' field. options: Additional parameters like date range, source filters. Returns: News search response containing: - status: "ok" for successful requests - news: List of news articles with title, url, description, date - npt: Next page token for pagination (if available) Raises: FourGetAuthError: Rate limited or invalid authentication FourGetAPIError: API returned non-success status FourGetTransportError: Network or HTTP protocol errors Example: >>> result = await client.news_search("artificial intelligence") >>> for article in result.get('news', []): >>> print(f"{article['title']} - {article['date']}") """ return await self._call_search('news', query, page_token=page_token, options=options)
- src/server.py:113-123 (helper)Utility function to merge engine selection with extra parameters for API options.def combine_options( engine: SearchEngine | None, extras: dict[str, Any] | None ) -> dict[str, Any] | None: if engine is None and not extras: return None options = dict(extras) if extras else {} if engine is not None: options['scraper'] = engine.value return options