search
Search the web to find information and return relevant results for queries, supporting AI agents with web data retrieval.
Instructions
Search the web and return results ($0.002)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| count | No |
Implementation Reference
- index.js:50-79 (handler)General tool handler function that executes requests to the IteraTools API.
async function callTool(endpoint, params) { const fetch = (await import('node-fetch')).default; const isGet = ['GET'].includes((TOOLS.find(t => t.endpoint === endpoint) || {}).method); const url = isGet ? `${BASE_URL}${endpoint}?${new URLSearchParams(params)}` : `${BASE_URL}${endpoint}`; const res = await fetch(url, { method: isGet ? 'GET' : 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}`, }, body: isGet ? undefined : JSON.stringify(params), }); const text = await res.text(); let data; try { data = JSON.parse(text); } catch { data = { raw: text }; } if (!res.ok) { if (res.status === 402) { throw new Error(`Insufficient credits. Add credits at https://iteratools.com. Cost: ${TOOLS.find(t=>t.endpoint===endpoint)?.price || 'see docs'}`); } throw new Error(`API error ${res.status}: ${text.substring(0, 200)}`); } return data; } - index.js:30-30 (registration)Tool definition for "search" within the TOOLS configuration array.
{ name: 'search', description: 'Search the web and return results', inputSchema: { type: 'object', properties: { query: { type: 'string' }, count: { type: 'number', default: 5 } }, required: ['query'] }, endpoint: '/search', price: '$0.002' },