vk_users_get
Retrieve user profile information from VKontakte using IDs or screen names, specifying which fields to return.
Instructions
Get information about VK users by their IDs or screen names
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_ids | No | Comma-separated user IDs or screen names | |
| fields | No | Profile fields to return |
Implementation Reference
- src/index.js:230-235 (handler)The tool handler for vk_users_get - extracts arguments (user_ids, fields) and calls the VK client's usersGet method with default fields if not provided
case 'vk_users_get': result = await vk.usersGet({ user_ids: args.user_ids, fields: args.fields || 'photo_200,online,status', }); break; - src/index.js:94-105 (schema)Tool registration and input schema definition for vk_users_get - defines the tool name, description, and expected parameters (user_ids and fields)
const tools = [ { name: 'vk_users_get', description: 'Get information about VK users by their IDs or screen names', inputSchema: { type: 'object', properties: { user_ids: { type: 'string', description: 'Comma-separated user IDs or screen names' }, fields: { type: 'string', description: 'Profile fields to return' }, }, }, }, - src/index.js:51-52 (helper)VKClient usersGet method - a wrapper that calls the VK API's users.get method with provided parameters
// Users usersGet(params) { return this.call('users.get', params); } - src/index.js:29-49 (helper)VKClient.call method - the core API call handler that constructs the request with access token, API version, and makes the POST request to VK's API endpoint
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; }