fourget_image_search
Search for images using the 4get meta search engine to find relevant pictures with URLs, thumbnails, and metadata. Supports pagination and filtering options.
Instructions
Search for images using the 4get meta search engine. Returns image results with URLs, thumbnails, and metadata. Supports pagination via the 'npt' token and various image filters.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| extra_params | No | ||
| page_token | No | ||
| query | Yes |
Implementation Reference
- src/server.py:154-164 (handler)The MCP tool handler function that executes the image search logic by calling FourGetClient.image_search with prepared options.async def fourget_image_search( query: str, page_token: str | None = None, engine: EngineParam = None, extra_params: dict[str, Any] | None = None, ) -> dict[str, Any]: return await client.image_search( query=query, page_token=page_token, options=combine_options(engine, extra_params), )
- src/server.py:52-55 (schema)Input schema component: Annotated type for the optional 'engine' parameter defining allowed search engine values.EngineParam = Annotated[ SearchEngine | None, Field(description='Optional search engine override (maps to 4get "scraper" query parameter).'), ]
- src/server.py:17-50 (schema)Input schema component: Enum defining supported search engines for the 'engine' parameter, with display names.class SearchEngine(str, Enum): """Enumeration of supported 4get scrapers with human-friendly labels.""" DUCKDUCKGO = ('ddg', 'DuckDuckGo') BRAVE = ('brave', 'Brave') MULLVAD_BRAVE = ('mullvad_brave', 'Mullvad (Brave)') YANDEX = ('yandex', 'Yandex') GOOGLE = ('google', 'Google') GOOGLE_CSE = ('google_cse', 'Google CSE') MULLVAD_GOOGLE = ('mullvad_google', 'Mullvad (Google)') STARTPAGE = ('startpage', 'Startpage') QWANT = ('qwant', 'Qwant') GHOSTERY = ('ghostery', 'Ghostery') YEP = ('yep', 'Yep') GREPPR = ('greppr', 'Greppr') CROWDVIEW = ('crowdview', 'Crowdview') MWMBL = ('mwmbl', 'Mwmbl') MOJEEK = ('mojeek', 'Mojeek') BAIDU = ('baidu', 'Baidu') COCCOC = ('coccoc', 'Coc Coc') SOLOFIELD = ('solofield', 'Solofield') MARGINALIA = ('marginalia', 'Marginalia') WIBY = ('wiby', 'wiby') CURLIE = ('curlie', 'Curlie') def __new__(cls, value: str, label: str): obj = str.__new__(cls, value) obj._value_ = value obj.display_name = label return obj def __str__(self) -> str: # pragma: no cover - exercised via enumNames metadata return self.display_name
- src/server.py:146-153 (registration)Tool registration via the @register_tool decorator, specifying name and description.@register_tool( name='fourget_image_search', description=( 'Search for images using the 4get meta search engine. Returns image ' 'results with URLs, thumbnails, and metadata. Supports pagination ' "via the 'npt' token and various image filters." ), )
- src/client.py:111-142 (helper)Supporting helper method in FourGetClient that implements the core image search API interaction.async def image_search( self, query: str, *, page_token: str | None = None, options: Mapping[str, Any] | None = None, ) -> dict[str, Any]: """Search for images using the 4get API. Args: query: Image search query. Ignored when using page_token. page_token: Pagination token from previous response's 'npt' field. options: Additional parameters like size, color, type filters. Returns: Image search response containing: - status: "ok" for successful requests - image: List of image results with url, title, thumb info - 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.image_search("python logo") >>> for img in result.get('image', []): >>> print(f"Image: {img['url']}") """ return await self._call_search('images', query, page_token=page_token, options=options)