chatgpt
Send prompts to ChatGPT with optional web search and geolocation settings to get AI-powered responses tailored to specific regions.
Instructions
Search and interact with ChatGPT for AI-powered responses and conversations
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Prompt to send to ChatGPT | |
| search | No | Activates ChatGPT's web search functionality | |
| geo | No | Geolocation of the desired request, expressed as a country name |
Implementation Reference
- src/tools/chatgpt/chatgpt-tool.ts:8-52 (handler)ChatGPTTool class: contains the full handler logic. The register() method (line 15-51) defines the 'chatgpt' tool with input schema, calls sapiClient.scrape() with target SCRAPER_API_TARGETS.CHATGPT, and transforms the response.
export class ChatGPTTool extends Tool { toolset = TOOLSET.AI; transformResponse = ({ data }: { data: object }) => { return { data: JSON.stringify(data, null, 2) }; }; register = ({ server, sapiClient, auth }: ToolRegistrationArgs) => { server.registerTool( 'chatgpt', { description: 'Search and interact with ChatGPT for AI-powered responses and conversations', inputSchema: { prompt: z.string().describe('Prompt to send to ChatGPT'), search: z.boolean().describe("Activates ChatGPT's web search functionality").optional(), geo: zodGeo, }, annotations: { readOnlyHint: true, openWorldHint: true, }, }, async (scrapingParams: ScrapingMCPParams, extra: ProgressExtra) => { const params = { ...scrapingParams, target: SCRAPER_API_TARGETS.CHATGPT, parse: true, } satisfies ScraperAPIParams; const { data } = await sapiClient.scrape<object>({ auth, scrapingParams: params, extra }); const { data: text } = this.transformResponse({ data }); return { content: [ { type: 'text', text, }, ], }; } ); }; } - Input schema for the chatgpt tool: prompt (string), search (optional boolean), geo (optional string from zodGeo). Annotations: readOnlyHint, openWorldHint.
{ description: 'Search and interact with ChatGPT for AI-powered responses and conversations', inputSchema: { prompt: z.string().describe('Prompt to send to ChatGPT'), search: z.boolean().describe("Activates ChatGPT's web search functionality").optional(), geo: zodGeo, }, annotations: { readOnlyHint: true, openWorldHint: true, }, }, - src/server/sapi-base-server.ts:95-97 (registration)Registration of ChatGPTTool in the static allTools array on the server. ChatGPTTool is instantiated at line 95 and registered via the registerTools/registerAllTools flow.
new ChatGPTTool(), new PerplexityTool(), ]; - src/tools/index.ts:7-7 (registration)Barrel export re-exporting the chatgpt tool module from src/tools/chatgpt.
export * from './chatgpt'; - src/zod/zod-types.ts:3-6 (helper)zodGeo helper schema used in the chatgpt tool input: an optional string describing geolocation as a country name.
export const zodGeo = z .string() .describe('Geolocation of the desired request, expressed as a country name') .optional();