get_posts
Retrieve recent social media posts from X, Instagram, and Threads via the Sociona API for monitoring and management purposes.
Instructions
Get recent posts published via the API
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of posts to retrieve (max 100) |
Implementation Reference
- src/index.ts:276-303 (handler)The handler function that implements the logic for the 'get_posts' tool. It calls the API to retrieve recent posts with an optional limit, formats them into a list, and returns the response.private async getPosts(args: any) { const limit = args.limit || 50; const { posts } = await this.apiRequest('GET', `/posts?limit=${limit}`); if (!posts || posts.length === 0) { return { content: [ { type: 'text', text: 'No posts found.', }, ], }; } const postList = posts .map((p: any) => `- ${p.provider}: ${p.status} (${p.startedAt}) ${p.url ? `URL: ${p.url}` : ''}`) .join('\n'); return { content: [ { type: 'text', text: `Recent posts (last ${posts.length}):\n${postList}`, }, ], }; }
- src/index.ts:94-105 (schema)The input schema for the 'get_posts' tool, defining the optional 'limit' parameter.inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Number of posts to retrieve (max 100)', default: 50, minimum: 1, maximum: 100, }, }, },
- src/index.ts:91-106 (registration)The tool registration in the ListTools response, including name, description, and input schema.{ name: 'get_posts', description: 'Get recent posts published via the API', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Number of posts to retrieve (max 100)', default: 50, minimum: 1, maximum: 100, }, }, }, },
- src/index.ts:144-145 (handler)The switch case dispatcher that routes 'get_posts' tool calls to the getPosts handler method.case 'get_posts': return await this.getPosts(args);