image_rembg
Remove backgrounds from images using a URL input to isolate subjects for design, e-commerce, or content creation.
Instructions
Remove background from an image ($0.003)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Image URL |
Implementation Reference
- index.js:50-79 (handler)The callTool function acts as a generic handler for all registered tools, including 'image_rembg', by dynamically calling the associated endpoint using an API key.
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:19-19 (registration)Tool definition and configuration for 'image_rembg', including its endpoint, schema, and metadata.
{ name: 'image_rembg', description: 'Remove background from an image', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'Image URL' } }, required: ['url'] }, endpoint: '/image/rembg', price: '$0.003' },