ai_top_sources
Identify which websites AI models reference most for a keyword. Analyze AI visibility across ChatGPT and Google to see top cited domains.
Instructions
Get the top domains cited in AI model responses for a keyword. Shows which sites AI models reference most. Costs 5 credits.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keyword | Yes | Keyword to search for (e.g. "plumber near me") | |
| location | No | Location for results (e.g. "Seattle, WA"). Default: US | |
| platforms | No | Platforms to query. Default: all | |
| limit | No | Max domains. Default: 10, max: 20 |
Implementation Reference
- src/tools/ai-visibility.ts:42-49 (handler)The handler function for the 'ai_top_sources' tool. It calls the API endpoint /v1/ai/top-sources with keyword, optional location, platforms, and limit parameters, then formats and returns the result.
withErrorHandling(async ({ keyword, location, platforms, limit }) => { const result = await callApi( "/v1/ai/top-sources", { keyword, ...(location && { location }), ...(platforms && { platforms }), ...(limit && { limit }) }, getAuth() ); return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] }; }) - src/tools/ai-visibility.ts:35-40 (schema)Input schema for 'ai_top_sources' tool: keyword (required string), location (optional string), platforms (optional array of 'chat_gpt' or 'google'), limit (optional number 1-20).
{ keyword: z.string().min(1).describe('Keyword to search for (e.g. "plumber near me")'), location: z.string().optional().describe('Location for results (e.g. "Seattle, WA"). Default: US'), platforms: z.array(z.enum(["chat_gpt", "google"])).optional().describe("Platforms to query. Default: all"), limit: z.number().int().min(1).max(20).optional().describe("Max domains. Default: 10, max: 20"), }, - src/tools/ai-visibility.ts:32-50 (registration)Registration of the 'ai_top_sources' tool via server.tool() within the registerAIVisibilityTools function. Includes the name, description, Zod schema, read-only flags, and the handler.
server.tool( "ai_top_sources", "Get the top domains cited in AI model responses for a keyword. Shows which sites AI models reference most. Costs 5 credits.", { keyword: z.string().min(1).describe('Keyword to search for (e.g. "plumber near me")'), location: z.string().optional().describe('Location for results (e.g. "Seattle, WA"). Default: US'), platforms: z.array(z.enum(["chat_gpt", "google"])).optional().describe("Platforms to query. Default: all"), limit: z.number().int().min(1).max(20).optional().describe("Max domains. Default: 10, max: 20"), }, READ_ONLY, withErrorHandling(async ({ keyword, location, platforms, limit }) => { const result = await callApi( "/v1/ai/top-sources", { keyword, ...(location && { location }), ...(platforms && { platforms }), ...(limit && { limit }) }, getAuth() ); return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] }; }) ); - src/server.ts:13-13 (registration)Import of registerAIVisibilityTools from the ai-visibility module.
import { registerAIVisibilityTools } from "./tools/ai-visibility.js"; - src/server.ts:45-45 (registration)Call to registerAIVisibilityTools(server, getAuth) which registers the 'ai_top_sources' (and other AI visibility) tools on the MCP server.
registerAIVisibilityTools(server, getAuth);