WebSearch
Le WebSearch permet à vos modèles et agents Clovis d'accéder au Web en temps réel pour enrichir leurs réponses avec des informations à jour.
Concrètement, votre modèle peut :
- lancer des recherches web,
- extraire le contenu de pages précises,
- cartographier et explorer des sites entiers,
- analyser et synthétiser des contenus récents,
- fournir des réponses fiables et contextualisées.
Le WebSearch est exposé sous forme de serveur MCP que votre application, votre agent ou votre orchestrateur peut appeler directement.
Pré-requis
Une clé API Clovis valide (Bearer token)
La clé API doit avoir accès au WebSearch
Accès réseau à la gateway Clovis : https://llm-gateway.clovis-ai.fr
Endpoint MCP
Le serveur MCP WebSearch est accessible à l'URL suivante :
https://llm-gateway.clovis-ai.fr/tools/websearch/mcp
Toutes les requêtes doivent inclure :
- un header
Authorization: Bearer <CLOVIS_API_KEY> - un header
Content-Type: application/json - un header
Accept: application/json, text/event-stream
Le serveur utilise le protocole MCP (JSON-RPC 2.0 sur HTTP avec Server-Sent Events).
Outils disponibles
Le serveur MCP expose 5 outils couvrant l'ensemble de la chaîne d'exploitation du web : découvrir, lire, cartographier, explorer et surveiller.
websearch-search
Effectue une recherche web sécurisée via l'API Tavily, avec un pipeline de sanitisation utilisant ClovisLLM pour détecter les informations sensibles.
| Paramètre | Type | Obligatoire | Défaut | Description |
|---|---|---|---|---|
query | string | ✔️ | — | Requête de recherche |
search_depth | string | "basic" | Profondeur : "basic", "advanced", "fast" ou "ultra-fast" | |
max_results | integer | 10 | Nombre maximum de résultats (1-20) | |
include_domains | array<string> | null | Domaines à inclure uniquement | |
exclude_domains | array<string> | null | Domaines à exclure | |
topic | string | "general" | Catégorie : "general" ou "news" | |
time_range | string | null | Filtre temporel : "day", "week", "month" ou "year" | |
start_date | string | null | Date de début (YYYY-MM-DD). Remplace time_range | |
end_date | string | null | Date de fin (YYYY-MM-DD). Remplace time_range | |
include_images | boolean | false | Inclure des images dans les résultats | |
include_image_descriptions | boolean | false | Inclure des descriptions d'images (include_images requis) | |
include_raw_content | boolean | false | Inclure le contenu brut des pages | |
country | string | null | Nom de pays pour orienter les résultats (ex : "france", "united states") | |
include_favicon | boolean | false | Inclure les favicons | |
exact_match | boolean | false | Retourner uniquement les résultats correspondant exactement |
websearch-extract
Extrait le contenu d'une ou plusieurs URL. Retourne le contenu au format markdown ou text. Le mode advanced permet de gérer les pages protégées ou complexes (LinkedIn, tableaux, contenu embarqué).
| Paramètre | Type | Obligatoire | Défaut | Description |
|---|---|---|---|---|
urls | array<string> | ✔️ | — | Liste des URL à extraire |
extract_depth | string | "basic" | "basic" ou "advanced" pour les pages protégées/complexes | |
include_images | boolean | false | Inclure les images des pages | |
format | string | "markdown" | Format de sortie : "markdown" ou "text" | |
include_favicon | boolean | false | Inclure les favicons | |
query | string | null | Requête optionnelle pour reranker les chunks par pertinence |
websearch-crawl
Explore un site à partir d'une URL racine et suit les liens internes jusqu'à une profondeur et un nombre de pages définis.
| Paramètre | Type | Obligatoire | Défaut | Description |
|---|---|---|---|---|
url | string | ✔️ | — | URL racine de l'exploration |
max_depth | integer | 1 | Profondeur maximale depuis l'URL de base | |
max_breadth | integer | 20 | Nombre maximum de liens à suivre par page | |
limit | integer | 50 | Nombre total de pages à traiter | |
instructions | string | null | Instructions en langage naturel pour filtrer les pages | |
select_paths | array<string> | null | Patterns regex pour filtrer les chemins (ex : "/docs/.*") | |
select_domains | array<string> | null | Patterns regex pour restreindre à certains domaines | |
allow_external | boolean | true | Suivre les liens externes | |
extract_depth | string | "basic" | "basic" ou "advanced" pour tableaux/contenu embarqué | |
format | string | "markdown" | Format de sortie : "markdown" ou "text" | |
include_favicon | boolean | false | Inclure les favicons |
websearch-map
Cartographie la structure d'un site. Retourne une liste d'URL découvertes sans extraire le contenu textuel.
| Paramètre | Type | Obligatoire | Défaut | Description |
|---|---|---|---|---|
url | string | ✔️ | — | URL racine de la cartographie |
max_depth | integer | 1 | Profondeur maximale d'exploration | |
max_breadth | integer | 20 | Nombre maximum de liens par page | |
limit | integer | 50 | Nombre total de pages à traiter | |
instructions | string | null | Instructions en langage naturel pour filtrer les pages | |
select_paths | array<string> | null | Patterns regex pour filtrer les chemins | |
select_domains | array<string> | null | Patterns regex pour le filtrage par domaine | |
allow_external | boolean | true | Inclure les liens externes |
websearch-search_status
Vérifie le statut du serveur et des services dépendants (santé de Tavily, état des guardrails et de la sanitisation).
Exemples de code
Initialiser la connexion MCP
- curl
- Python
curl -X POST https://llm-gateway.clovis-ai.fr/tools/websearch/mcp \
-H "Authorization: Bearer $CLOVIS_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": { "name": "my-app", "version": "1.0.0" }
}
}'
import requests
CLOVIS_API_KEY = "sk-xxxx"
MCP_URL = "https://llm-gateway.clovis-ai.fr/tools/websearch/mcp"
headers = {
"Authorization": f"Bearer {CLOVIS_API_KEY}",
"Content-Type": "application/json",
"Accept": "application/json, text/event-stream",
}
resp = requests.post(MCP_URL, headers=headers, json={
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": {"name": "my-app", "version": "1.0.0"},
},
})
print(resp.text)
Lister les outils
- curl
- Python
curl -X POST https://llm-gateway.clovis-ai.fr/tools/websearch/mcp \
-H "Authorization: Bearer $CLOVIS_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list",
"params": {}
}'
resp = requests.post(MCP_URL, headers=headers, json={
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list",
"params": {},
})
print(resp.text)
Effectuer une recherche web
- curl
- Python
curl -X POST https://llm-gateway.clovis-ai.fr/tools/websearch/mcp \
-H "Authorization: Bearer $CLOVIS_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "websearch-search",
"arguments": {
"query": "Quelles sont les dernières actualités sur l'IA en France ?",
"max_results": 5,
"search_depth": "advanced",
"topic": "news",
"country": "france"
}
}
}'
resp = requests.post(MCP_URL, headers=headers, json={
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "websearch-search",
"arguments": {
"query": "Quelles sont les dernières actualités sur l'IA en France ?",
"max_results": 5,
"search_depth": "advanced",
"topic": "news",
"country": "france",
},
},
})
print(resp.text)
Extraire le contenu d'une URL
- curl
- Python
curl -X POST https://llm-gateway.clovis-ai.fr/tools/websearch/mcp \
-H "Authorization: Bearer $CLOVIS_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 4,
"method": "tools/call",
"params": {
"name": "websearch-extract",
"arguments": {
"urls": ["https://www.clovis-ai.fr"],
"format": "markdown",
"extract_depth": "basic"
}
}
}'
resp = requests.post(MCP_URL, headers=headers, json={
"jsonrpc": "2.0",
"id": 4,
"method": "tools/call",
"params": {
"name": "websearch-extract",
"arguments": {
"urls": ["https://www.clovis-ai.fr"],
"format": "markdown",
"extract_depth": "basic",
},
},
})
print(resp.text)
Réponse exemple
{
"jsonrpc": "2.0",
"id": 4,
"result": {
"content": [
{
"type": "text",
"text": "{\"success\":true,\"data\":{\"results\":[{\"url\":\"https://www.clovis-ai.fr\",\"title\":\"Clovis - IA de confiance\",\"raw_content\":\"# Clovis, l'IA de confiance.\n\nVotre plateforme d'intelligence artificielle 100% française...\"
}]}}"
}
],
"isError": false
}
}
Cartographier un site
- curl
- Python
curl -X POST https://llm-gateway.clovis-ai.fr/tools/websearch/mcp \
-H "Authorization: Bearer $CLOVIS_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 5,
"method": "tools/call",
"params": {
"name": "websearch-map",
"arguments": {
"url": "https://www.clovis-ai.fr",
"max_depth": 1,
"limit": 10
}
}
}'
resp = requests.post(MCP_URL, headers=headers, json={
"jsonrpc": "2.0",
"id": 5,
"method": "tools/call",
"params": {
"name": "websearch-map",
"arguments": {
"url": "https://www.clovis-ai.fr",
"max_depth": 1,
"limit": 10,
},
},
})
print(resp.text)
Explorer un site (crawl)
- curl
- Python
curl -X POST https://llm-gateway.clovis-ai.fr/tools/websearch/mcp \
-H "Authorization: Bearer $CLOVIS_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 6,
"method": "tools/call",
"params": {
"name": "websearch-crawl",
"arguments": {
"url": "https://www.clovis-ai.fr",
"max_depth": 1,
"limit": 10,
"format": "markdown"
}
}
}'
resp = requests.post(MCP_URL, headers=headers, json={
"jsonrpc": "2.0",
"id": 6,
"method": "tools/call",
"params": {
"name": "websearch-crawl",
"arguments": {
"url": "https://www.clovis-ai.fr",
"max_depth": 1,
"limit": 10,
"format": "markdown",
},
},
})
print(resp.text)
Vérifier le statut du service
- curl
- Python
curl -X POST https://llm-gateway.clovis-ai.fr/tools/websearch/mcp \
-H "Authorization: Bearer $CLOVIS_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{
"jsonrpc": "2.0",
"id": 7,
"method": "tools/call",
"params": {
"name": "websearch-search_status",
"arguments": {}
}
}'
resp = requests.post(MCP_URL, headers=headers, json={
"jsonrpc": "2.0",
"id": 7,
"method": "tools/call",
"params": {
"name": "websearch-search_status",
"arguments": {},
},
})
print(resp.text)
Réponse exemple
{
"jsonrpc": "2.0",
"id": 7,
"result": {
"content": [
{
"type": "text",
"text": "{\"success\":true,\"data\":{\"server_version\":\"0.2.0\",\"tavily\":{\"healthy\":true,\"error\":null},\"guardrail\":{\"enabled\":true,\"status\":\"healthy\",\"endpoint\":\"https://llm-gateway.clovis-ai.fr/\",\"model\":\"ClovisLLM/gpt-oss-120b\"},\"sanitization\":{\"requests\":true,\"responses\":true}}}"
}
],
"isError": false
}
}