vk_wall_post
Publish posts to VKontakte walls using the VK API. Create text content for user or community profiles with customizable ownership settings.
Instructions
Publish a new post on a wall
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner_id | No | Wall owner ID | |
| message | Yes | Post text content | |
| from_group | No | Post on behalf of community |
Implementation Reference
- src/index.js:246-252 (handler)The vk_wall_post tool handler that processes tool calls, extracts arguments, and calls vk.wallPost() with owner_id, message, and from_group parameters
case 'vk_wall_post': result = await vk.wallPost({ owner_id: args.owner_id, message: args.message, from_group: args.from_group ? 1 : 0, }); break; - src/index.js:119-131 (schema)Tool schema definition for vk_wall_post with name, description, inputSchema defining owner_id, message (required), and from_group parameters
{ name: 'vk_wall_post', description: 'Publish a new post on a wall', inputSchema: { type: 'object', properties: { owner_id: { type: 'number', description: 'Wall owner ID' }, message: { type: 'string', description: 'Post text content' }, from_group: { type: 'boolean', description: 'Post on behalf of community' }, }, required: ['message'], }, }, - src/index.js:56-56 (helper)VKClient.wallPost method that wraps the VK API wall.post call
wallPost(params) { return this.call('wall.post', params); } - src/index.js:29-49 (helper)VKClient.call method that executes VK API requests with authentication and error handling
async call(method, params = {}) { const body = new URLSearchParams({ ...params, access_token: this.accessToken, v: this.apiVersion, }); const response = await fetch(`${VK_API_BASE}/${method}`, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: body.toString(), }); const data = await response.json(); if (data.error) { throw new Error(`VK API Error ${data.error.error_code}: ${data.error.error_msg}`); } return data.response; } - src/index.js:225-319 (handler)The handleToolCall function that routes tool requests to appropriate VK API methods based on tool name
async function handleToolCall(name, args) { try { let result; switch (name) { case 'vk_users_get': result = await vk.usersGet({ user_ids: args.user_ids, fields: args.fields || 'photo_200,online,status', }); break; case 'vk_wall_get': result = await vk.wallGet({ owner_id: args.owner_id, domain: args.domain, count: args.count || 20, offset: args.offset, }); break; case 'vk_wall_post': result = await vk.wallPost({ owner_id: args.owner_id, message: args.message, from_group: args.from_group ? 1 : 0, }); break; case 'vk_wall_create_comment': result = await vk.wallCreateComment({ owner_id: args.owner_id, post_id: args.post_id, message: args.message, }); break; case 'vk_groups_get': result = await vk.groupsGet({ user_id: args.user_id, filter: args.filter, fields: args.fields || 'description,members_count', count: args.count || 100, }); break; case 'vk_groups_get_by_id': result = await vk.groupsGetById({ group_ids: args.group_ids, fields: args.fields || 'description,members_count', }); break; case 'vk_friends_get': result = await vk.friendsGet({ user_id: args.user_id, order: args.order, fields: args.fields || 'photo_200,online', count: args.count || 100, }); break; case 'vk_newsfeed_get': result = await vk.newsfeedGet({ filters: args.filters || 'post', count: args.count || 20, start_from: args.start_from, }); break; case 'vk_stats_get': result = await vk.statsGet({ group_id: args.group_id, interval: args.interval || 'day', intervals_count: args.intervals_count || 7, }); break; case 'vk_photos_get': result = await vk.photosGet({ owner_id: args.owner_id, album_id: args.album_id || 'wall', count: args.count || 50, }); break; default: throw new Error(`Unknown tool: ${name}`); } return JSON.stringify(result, null, 2); } catch (error) { return JSON.stringify({ error: error.message }); } }