vk_friends_get
Retrieve a user's friend list from VKontakte with options to filter by order, fields, and count.
Instructions
Get list of user friends
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | No | User ID | |
| order | No | ||
| fields | No | Profile fields | |
| count | No | Number of friends |
Implementation Reference
- src/index.js:278-285 (handler)The vk_friends_get tool handler that executes the friends.get API call with parameters (user_id, order, fields, count)
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; - src/index.js:169-181 (schema)Tool schema definition for vk_friends_get with name, description, and inputSchema specifying user_id, order (enum: hints/random/name), fields, and count parameters
{ name: 'vk_friends_get', description: 'Get list of user friends', inputSchema: { type: 'object', properties: { user_id: { type: 'number', description: 'User ID' }, order: { type: 'string', enum: ['hints', 'random', 'name'] }, fields: { type: 'string', description: 'Profile fields' }, count: { type: 'number', description: 'Number of friends' }, }, }, }, - src/index.js:64-64 (helper)VKClient wrapper method that delegates to the generic call method with 'friends.get' as the VK API endpoint
friendsGet(params) { return this.call('friends.get', params); } - src/index.js:29-49 (helper)Generic VK API call method that handles authentication, POST requests, and error responses for all VK API methods
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:330-330 (registration)Registration of the tools array (which includes vk_friends_get) with the MCP server's ListToolsRequestSchema handler
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools }));