create_post
Create a new feedback post in a Canny board with title, description, category, and custom fields to collect and organize customer feedback.
Instructions
Create a new post in a Canny board
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| authorId | Yes | ID of the user creating the post | |
| boardId | Yes | ID of the board to create the post in | |
| categoryId | No | ID of the category for the post (optional) | |
| customFields | No | Custom field values as key-value pairs (optional) | |
| details | No | Detailed description of the post (optional) | |
| title | Yes | Title of the post |
Implementation Reference
- src/tools/posts.ts:227-276 (handler)The complete createPostTool object defining the 'create_post' MCP tool, including input schema, description, and handler function that validates args, calls CannyClient.createPost, and formats success response.export const createPostTool = { name: 'create_post', description: 'Create a new post in a Canny board', inputSchema: { type: 'object', properties: { authorId: { type: 'string', description: 'ID of the user creating the post' }, boardId: { type: 'string', description: 'ID of the board to create the post in' }, title: { type: 'string', description: 'Title of the post' }, details: { type: 'string', description: 'Detailed description of the post (optional)' }, categoryId: { type: 'string', description: 'ID of the category for the post (optional)' }, customFields: { type: 'object', description: 'Custom field values as key-value pairs (optional)', additionalProperties: true }, }, required: ['authorId', 'boardId', 'title'], additionalProperties: false, }, handler: async (args: unknown, client: CannyClient) => { const { authorId, boardId, title, details, categoryId, customFields } = validateToolInput<CreatePostInput>(args, CreatePostSchema); const response = await client.createPost({ authorID: authorId, boardID: boardId, title, details, categoryID: categoryId, customFields, }); if (response.error) { throw new Error(`Failed to create post: ${response.error}`); } if (!response.data) { return 'Post creation failed - no data returned'; } const post = response.data; return `Successfully created post!\n\n` + `**${post.title}** (ID: ${post.id})\n` + `Board: ${post.board.name}\n` + `Author: ${post.author.name}\n` + `Status: ${post.status}\n` + `Created: ${new Date(post.createdAt).toLocaleString()}\n` + `URL: ${post.url}`; }, };
- src/tools/posts.ts:25-32 (schema)Zod validation schema (CreatePostSchema) used by validateToolInput in the create_post handler for input validation.const CreatePostSchema = z.object({ authorId: z.string().min(1, 'Author ID is required'), boardId: z.string().min(1, 'Board ID is required'), title: z.string().min(1, 'Title is required'), details: z.string().optional(), categoryId: z.string().optional(), customFields: z.record(z.any()).optional(), });
- src/tools/index.ts:29-45 (registration)Registration of createPostTool in the main exported tools array for MCP toolset.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/client/canny.ts:154-167 (helper)CannyClient.createPost helper method invoked by the create_post tool handler to make the API POST request to Canny.async createPost(data: { authorID: string; boardID: string; title: string; details?: string; categoryID?: string; customFields?: Record<string, any>; }): Promise<CannyApiResponse<CannyPost>> { return this.makeRequest<CannyPost>({ method: 'POST', url: '/posts/create', data, }); }
- src/tools/index.ts:3-9 (registration)Import statement that brings createPostTool into the index for registration.import { getPostsTool, getPostTool, searchPostsTool, createPostTool, updatePostTool } from './posts.js';