get_profiles
List all social profiles connected to your Sprout Social account to view and manage linked networks.
Instructions
List all social profiles connected to your Sprout Social account.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:100-108 (handler)Handler for the 'get_profiles' tool. Calls sproutRequest with GET /metadata/customer to list all social profiles connected to the Sprout Social account.
server.tool( "get_profiles", "List all social profiles connected to your Sprout Social account.", {}, async () => { const data = await sproutRequest("GET", "/metadata/customer"); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } ); - src/index.ts:100-108 (registration)Registration of the 'get_profiles' tool on the McpServer instance. No input schema needed (empty object).
server.tool( "get_profiles", "List all social profiles connected to your Sprout Social account.", {}, async () => { const data = await sproutRequest("GET", "/metadata/customer"); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } ); - src/index.ts:29-59 (helper)Helper function sproutRequest used by the get_profiles handler. Makes authenticated GET/POST requests to the Sprout Social API.
async function sproutRequest( method: "GET" | "POST", path: string, body?: Record<string, unknown> ): Promise<unknown> { const { apiKey, customerId } = getConfig(); const url = `${SPROUT_API_BASE}/v1/${customerId}${path}`; const headers: Record<string, string> = { Authorization: `Bearer ${apiKey}`, Accept: "application/json", }; const options: RequestInit = { method, headers }; if (body) { headers["Content-Type"] = "application/json"; options.body = JSON.stringify(body); } const response = await fetch(url, options); if (!response.ok) { const errorText = await response.text(); throw new Error( `Sprout Social API error (${response.status}): ${errorText}` ); } return response.json(); }