get_client
Retrieve customer IDs and names from your Sprout Social account.
Instructions
Get your Sprout Social customer IDs and names.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:90-98 (registration)The tool 'get_client' is registered using server.tool() with no input schema (empty object {}) and a handler that calls sproutMetadataRequest('/metadata/client').
server.tool( "get_client", "Get your Sprout Social customer IDs and names.", {}, async () => { const data = await sproutMetadataRequest("/metadata/client"); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } ); - src/index.ts:94-97 (handler)The handler for 'get_client' - an async function that fetches metadata via sproutMetadataRequest('/metadata/client') and returns the result as JSON text content.
async () => { const data = await sproutMetadataRequest("/metadata/client"); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } - src/index.ts:93-93 (schema)The schema/input for 'get_client' is an empty object {}, meaning it takes no parameters.
{}, - src/index.ts:61-81 (helper)Helper function sproutMetadataRequest() used by the get_client handler to make the GET request to '/metadata/client'.
async function sproutMetadataRequest(path: string): Promise<unknown> { const { apiKey } = getConfig(); const url = `${SPROUT_API_BASE}/v1${path}`; const response = await fetch(url, { method: "GET", headers: { Authorization: `Bearer ${apiKey}`, Accept: "application/json", }, }); if (!response.ok) { const errorText = await response.text(); throw new Error( `Sprout Social API error (${response.status}): ${errorText}` ); } return response.json(); }