get_publishing_post
Retrieve details of a specific publishing post using its unique ID to access post content, status, and metadata.
Instructions
Retrieve details of a specific publishing post by its ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| publishing_post_id | Yes | The unique ID of the publishing post to retrieve. |
Implementation Reference
- src/index.ts:459-474 (registration)Registration and handler for the 'get_publishing_post' tool. Registered via server.tool() with a Zod schema expecting a 'publishing_post_id' string. The handler makes a GET request to /publishing/posts/{id} using the sproutRequest helper and returns the JSON response.
server.tool( "get_publishing_post", "Retrieve details of a specific publishing post by its ID.", { publishing_post_id: z .string() .describe("The unique ID of the publishing post to retrieve."), }, async ({ publishing_post_id }) => { const data = await sproutRequest( "GET", `/publishing/posts/${publishing_post_id}` ); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } ); - src/index.ts:462-466 (schema)Input schema for the tool using Zod. Defines a required 'publishing_post_id' string parameter describing the unique ID of the publishing post to retrieve.
{ publishing_post_id: z .string() .describe("The unique ID of the publishing post to retrieve."), }, - src/index.ts:29-59 (helper)The sproutRequest helper function used by the tool handler to make authenticated API calls to Sprout Social. Constructs the full URL, adds Bearer auth, and handles error responses.
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(); }