vk_stats_get
Retrieve community statistics from VKontakte for administrators to analyze engagement and growth trends over specified time periods.
Instructions
Get community statistics (admin only)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group_id | Yes | Community ID | |
| interval | No | ||
| intervals_count | No | Number of intervals |
Implementation Reference
- src/index.js:295-301 (handler)Tool handler logic for vk_stats_get - executes when the tool is called, passes arguments to the VK API statsGet method with default values for interval ('day') and intervals_count (7)
case 'vk_stats_get': result = await vk.statsGet({ group_id: args.group_id, interval: args.interval || 'day', intervals_count: args.intervals_count || 7, }); break; - src/index.js:194-206 (schema)Tool registration and input schema definition for vk_stats_get - defines the tool name, description, and required/optional parameters (group_id, interval, intervals_count)
{ name: 'vk_stats_get', description: 'Get community statistics (admin only)', inputSchema: { type: 'object', properties: { group_id: { type: 'number', description: 'Community ID' }, interval: { type: 'string', enum: ['day', 'week', 'month', 'year', 'all'] }, intervals_count: { type: 'number', description: 'Number of intervals' }, }, required: ['group_id'], }, }, - src/index.js:70-70 (helper)VK API helper method that wraps the stats.get API call, used by the vk_stats_get tool handler
statsGet(params) { return this.call('stats.get', params); } - src/index.js:29-49 (helper)Core VK API call method that handles authentication, HTTP requests, and error responses for all VK API methods including stats.get
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; }