Skip to main content
Glama
bulatko

vk-mcp-server

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
NameRequiredDescriptionDefault
user_idNoUser ID
orderNo
fieldsNoProfile fields
countNoNumber of friends

Implementation Reference

  • 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;
  • 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' },
        },
      },
    },
  • 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); }
  • 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 }));

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bulatko/vk-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server