get_posts
Retrieve posts from a Canny feedback board with filtering options for status, search terms, and sorting to manage customer feedback effectively.
Instructions
Get posts from a specific Canny board with optional filtering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| boardId | Yes | ID of the board to fetch posts from | |
| limit | No | Number of posts to retrieve | |
| search | No | Search term to filter posts | |
| skip | No | Number of posts to skip for pagination | |
| sort | No | Sort order for posts | |
| status | No | Filter by post status |
Implementation Reference
- src/tools/posts.ts:77-113 (handler)The main handler function for the 'get_posts' tool. It validates the input parameters using Zod schema, calls the Canny client to fetch posts from a board, handles errors, processes the posts data, and returns a formatted string summary of the posts.handler: async (args: unknown, client: CannyClient) => { const { boardId, limit, skip, status, search, sort } = validateToolInput<GetPostsInput>(args, GetPostsSchema); const response = await client.getPosts(boardId, { limit, skip, status, search, sort }); if (response.error) { throw new Error(`Failed to fetch posts: ${response.error}`); } if (!response.data?.posts || response.data.posts.length === 0) { return 'No posts found matching the criteria.'; } const posts = response.data.posts.map(post => ({ id: post.id, title: post.title, details: post.details?.substring(0, 200) + (post.details && post.details.length > 200 ? '...' : ''), status: post.status, author: post.author.name, votes: post.votes, score: post.score, tags: post.tags.map(tag => tag.name), createdAt: new Date(post.createdAt).toLocaleDateString(), url: post.url, })); return `Found ${posts.length} post(s) in board ${boardId}:\n\n${posts .map((post, index) => `${index + 1}. **${post.title}** (ID: ${post.id})\n` + ` Status: ${post.status} | Votes: ${post.votes} | Score: ${post.score}\n` + ` Author: ${post.author} | Created: ${post.createdAt}\n` + ` Tags: ${post.tags.length > 0 ? post.tags.join(', ') : 'None'}\n` + ` Details: ${post.details || 'No description'}\n` + ` URL: ${post.url}\n` ) .join('\n')}${response.data.hasMore ? '\n(More posts available - increase limit or skip to see more)' : ''}`; },
- src/tools/posts.ts:56-76 (schema)The JSON schema defining the input parameters for the 'get_posts' tool, including boardId (required), pagination, filtering by status/search/sort options.inputSchema: { type: 'object', properties: { boardId: { type: 'string', description: 'ID of the board to fetch posts from' }, limit: { type: 'number', minimum: 1, maximum: 50, default: 10, description: 'Number of posts to retrieve' }, skip: { type: 'number', minimum: 0, default: 0, description: 'Number of posts to skip for pagination' }, status: { type: 'string', enum: ['open', 'under review', 'planned', 'in progress', 'complete', 'closed'], description: 'Filter by post status' }, search: { type: 'string', description: 'Search term to filter posts' }, sort: { type: 'string', enum: ['newest', 'oldest', 'relevance', 'trending'], description: 'Sort order for posts' }, }, required: ['boardId'], additionalProperties: false, },
- src/tools/posts.ts:5-12 (schema)Zod schema used internally for runtime validation of get_posts tool inputs before calling the Canny client.const GetPostsSchema = z.object({ boardId: z.string().min(1, 'Board ID is required'), limit: z.number().min(1).max(50).optional().default(10), skip: z.number().min(0).optional().default(0), status: z.enum(['open', 'under review', 'planned', 'in progress', 'complete', 'closed']).optional(), search: z.string().optional(), sort: z.enum(['newest', 'oldest', 'relevance', 'trending']).optional(), });
- src/tools/index.ts:29-45 (registration)The main tools array registration where getPostsTool is included (line 34) among other Canny MCP tools.export const tools: Tool[] = [ // Board management getBoardsTool, // Post management getPostsTool, getPostTool, searchPostsTool, createPostTool, updatePostTool, // Extended functionality - temporarily disabled for debugging // getCategoresTool, // getCommentsTool, // getUsersTool, // getTagsTool, ];
- src/tools/index.ts:3-9 (registration)Import statement that brings the getPostsTool into the index module for registration in the tools array.import { getPostsTool, getPostTool, searchPostsTool, createPostTool, updatePostTool } from './posts.js';