get_users
Retrieve a list of all users in your Sprout Social account to manage team members and permissions.
Instructions
List all users in your Sprout Social account.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:130-137 (handler)The handler function for the 'get_users' tool. It calls sproutRequest with GET method to '/metadata/customer/users' and returns the result as text content.
server.tool( "get_users", "List all users in your Sprout Social account.", {}, async () => { const data = await sproutRequest("GET", "/metadata/customer/users"); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } - src/index.ts:130-137 (registration)The tool is registered via server.tool() on the McpServer instance, with the name 'get_users', a description, empty schema, and the handler callback.
server.tool( "get_users", "List all users in your Sprout Social account.", {}, async () => { const data = await sproutRequest("GET", "/metadata/customer/users"); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } - src/index.ts:29-59 (helper)The sproutRequest helper function used by get_users to make authenticated API 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(); } - src/index.ts:133-133 (schema)The get_users tool has an empty schema object {}, meaning it takes no input parameters.
{},