write_post
Create and publish content to BAND groups using the Band API. Specify the target group, post content, and optional push notification settings.
Instructions
Write a post to BAND.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| band_key | Yes | band identifier | |
| content | Yes | post content | |
| do_push | No | whether to send push notification |
Implementation Reference
- src/writePost/tool.ts:61-81 (handler)The main handler function for the 'write_post' tool that performs the API call to create a post on BAND.export async function handleToolCall( band_key: string, content: string, do_push?: boolean ) { const params: Record<string, unknown> = { band_key, content }; if (do_push !== undefined) (params as Record<string, unknown>).do_push = do_push; const postData = await bandApiClient.post<WritePostResponse>( "/v2.2/band/post/create", params ); return { content: [ { type: "text", text: JSON.stringify(postData, null, 2), }, ], }; }
- src/writePost/tool.ts:8-52 (schema)The ToolDefinition including inputSchema and outputSchema for the 'write_post' tool.export const ToolDefinition: Tool = { name: "write_post", description: "Write a post to BAND.", inputSchema: { type: "object", properties: { band_key: { type: "string", title: "Band Key", description: "band identifier", }, content: { type: "string", title: "Content", description: "post content", }, do_push: { type: "boolean", title: "Do Push", description: "whether to send push notification", }, }, required: ["band_key", "content"], }, outputSchema: { type: "object", properties: { result_code: { type: "number", description: "Result code", }, result_data: { type: "object", description: "Result data", properties: { post_key: { type: "string", description: "created post identifier", }, }, }, }, required: ["result_code", "result_data"], }, };
- src/tools.ts:15-28 (registration)Registration of the 'write_post' ToolDefinition (line 25) in the main bandTools array.export const bandTools: Tool[] = [ profile.ToolDefinition, bands.ToolDefinition, posts.ToolDefinition, post.ToolDefinition, comments.ToolDefinition, permissions.ToolDefinition, albums.ToolDefinition, photos.ToolDefinition, writeComment.ToolDefinition, writePost.ToolDefinition, removePost.ToolDefinition, removeComment.ToolDefinition, ];
- src/tools.ts:73-78 (registration)Dispatch case in the main handleToolCall function that routes 'write_post' calls to the specific handler.case "write_post": return writePost.handleToolCall( a.band_key as string, a.content as string, a.do_push as boolean | undefined );
- src/writePost/index.ts:1-5 (helper)Index file that bundles and exports ToolDefinition and handleToolCall for writePost.import {ToolDefinition, handleToolCall} from "./tool.js"; const writePost = {ToolDefinition, handleToolCall} export default writePost;