get_positioning_dashboard
Retrieve competitor positioning analysis including homepage messaging, target audience, differentiators, and AI-driven insights for the current snapshot.
Instructions
Get the latest Positioning analysis for all competitors. Returns homepage messaging: page title, main headline, tagline, value proposition, primary/secondary CTAs, key offerings, target audience, main differentiator, pricing mentions, free trial info, and AI analysis with insights and actions. Use this for the current snapshot; use get_positioning_history for past runs. Read-only. Returns JSON object.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID (from list_projects) |
Implementation Reference
- src/tools.ts:189-197 (schema)Tool definition / schema for get_positioning_dashboard: defines name, description, Zod input parameters (projectId as 24-char hex string), and API path template.
{ name: "get_positioning_dashboard", description: "Get the latest Positioning analysis for all competitors. Returns homepage messaging: page title, main headline, tagline, value proposition, primary/secondary CTAs, key offerings, target audience, main differentiator, pricing mentions, free trial info, and AI analysis with insights and actions. Use this for the current snapshot; use get_positioning_history for past runs. Read-only. Returns JSON object.", parameters: z.object({ projectId: objectId("Project ID (from list_projects)"), }), path: (a) => `/v1/projects/${a.projectId}/positioning`, }, - src/index.ts:16-25 (registration)Registration: the generic loop iterating over all tools (including get_positioning_dashboard) and registering them with the MCP server via server.tool().
for (const tool of tools) { server.tool(tool.name, tool.description, tool.parameters.shape, async (args: Record<string, any>) => { const path = tool.path(args); const query: Record<string, any> = {}; for (const key of tool.queryParams ?? []) { if (args[key] !== undefined) query[key] = args[key]; } return apiGet(path, Object.keys(query).length ? query : undefined); }); } - src/index.ts:17-24 (handler)Handler logic: the generic async handler that calls the API client with the constructed path and optional query parameters. This is the execution logic for get_positioning_dashboard.
server.tool(tool.name, tool.description, tool.parameters.shape, async (args: Record<string, any>) => { const path = tool.path(args); const query: Record<string, any> = {}; for (const key of tool.queryParams ?? []) { if (args[key] !== undefined) query[key] = args[key]; } return apiGet(path, Object.keys(query).length ? query : undefined); }); - src/api-client.ts:3-58 (helper)Helper: apiGet function that makes HTTP GET requests to the CompetLab API. Called by the generic tool handler with path=/v1/projects/{projectId}/positioning.
export async function apiGet( path: string, query?: Record<string, string | number>, ): Promise<{ content: Array<{ type: "text"; text: string }>; isError?: true }> { const apiKey = process.env.COMPETLAB_API_KEY; if (!apiKey) { return { content: [ { type: "text", text: JSON.stringify({ error: "api_key_missing", message: "COMPETLAB_API_KEY environment variable is not set", }), }, ], isError: true, }; } const url = new URL(`${API_BASE}${path}`); if (query) { for (const [k, v] of Object.entries(query)) { if (v !== undefined) url.searchParams.set(k, String(v)); } } try { const res = await fetch(url, { headers: { "CL-API-Key": apiKey }, }); const body = await res.text(); if (!res.ok) { return { content: [{ type: "text", text: body }], isError: true }; } return { content: [{ type: "text", text: body }] }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify({ error: "api_unreachable", message: err instanceof Error ? err.message : "Failed to reach CompetLab API", status: 503, }), }, ], isError: true, }; } }