Skip to main content
Glama
ssm82

Full VK MCP

by ssm82

vk_wall_get_comments

Retrieve comments from a VK wall post. Filter by owner, post, sort order, and include likes or thread details.

Instructions

Returns a list of comments on a post on a user wall or community wall.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
owner_idNoUser ID or community ID. Use a negative value to designate a community ID.
post_idNoPost ID.
need_likesNo'1' - to return the 'likes' field, '0' - not to return the 'likes' field (default)
start_comment_idNo
offsetNoOffset needed to return a specific subset of comments.
countNoNumber of comments to return (maximum 100).
sortNoSort order: 'asc' - chronological, 'desc' - reverse chronological
preview_lengthNoNumber of characters at which to truncate comments when previewed. By default, '90'. Specify '0' if you do not want to truncate comments.
extendedNo
fieldsNo
comment_idNoComment ID.
thread_items_countNoCount items in threads.

Implementation Reference

  • Tool registration/construction: maps each VK API method (including 'wall.getComments') to an MCP tool named 'vk_wall_get_comments' via getToolName().
    export function buildTools(methods) {
      return methods.map(method => ({
        name: getToolName(method.name),
        description: cleanDescription(method.description, method.name),
        inputSchema: buildInputSchema(method.parameters),
      }));
  • Handler: the generic handler function that routes 'vk_wall_get_comments' calls to vkClient.call('wall.getComments', ...).
    export function buildHandler(methods, vkClient) {
      const methodMap = new Map();
    
      for (const method of methods) {
        methodMap.set(getToolName(method.name), method.name);
      }
    
      return async function handler(params) {
        const { name, arguments: args } = params;
    
        if (!methodMap.has(name)) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({ error: `Unknown tool: ${name}` }, null, 2),
              },
            ],
            isError: true,
          };
        }
    
        const vkMethod = methodMap.get(name);
    
        try {
          const result = await vkClient.call(vkMethod, args || {});
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(result, null, 2),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({ error: error.message }, null, 2),
              },
            ],
            isError: true,
          };
        }
      };
    }
  • Helper: transforms VK API method name 'wall.getComments' into tool name 'vk_wall_get_comments'.
    function getToolName(methodName) {
      return `vk_${methodName
        .replace(/\./g, '_')
        .replace(/([a-z0-9])([A-Z])/g, '$1_$2')
        .toLowerCase()}`;
    }
  • Helper: VKClient.call() executes the actual VK API request for the 'wall.getComments' method when invoked.
    export class VKClient {
      constructor(accessToken) {
        this.accessToken = accessToken;
        this.apiVersion = '5.199';
        this.baseUrl = 'https://api.vk.com/method';
      }
    
      async call(method, params = {}, { timeoutMs = 30000 } = {}) {
        const normalized = {};
        for (const [k, v] of Object.entries(params)) {
          if (v === undefined || v === null) continue;
          if (typeof v === 'boolean') {
            normalized[k] = v ? '1' : '0';
          } else if (Array.isArray(v)) {
            normalized[k] = v.join(',');
          } else {
            normalized[k] = String(v);
          }
        }
    
        const body = new URLSearchParams({
          ...normalized,
          access_token: this.accessToken,
          v: this.apiVersion,
        });
    
        const controller = new AbortController();
        const timeout = setTimeout(() => controller.abort(), timeoutMs);
    
        try {
          const response = await fetch(`${this.baseUrl}/${method}`, {
            method: 'POST',
            headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
            body: body.toString(),
            signal: controller.signal,
          });
    
          const text = await response.text();
    
          if (!response.ok) {
            const safeText = text.replace(this.accessToken, '***');
            throw new Error(`VK HTTP Error ${response.status}: ${safeText}`);
          }
    
          let data;
          try {
            data = JSON.parse(text);
          } catch {
            const safeText = text.replace(this.accessToken, '***');
            throw new Error(`VK API returned non-JSON response: ${safeText}`);
          }
    
          if (data.error) {
            const code = data.error.error_code;
            const msg = data.error.error_msg;
            throw new Error(`VK API Error ${code}: ${msg}`);
          }
    
          return data.response;
        } catch (err) {
          if (err.name === 'AbortError') {
            throw new Error(`VK API timeout after ${timeoutMs}ms for method ${method}`);
          }
          throw err;
        } finally {
          clearTimeout(timeout);
        }
      }
    }
  • Schema: buildInputSchema generates the JSON input schema for 'vk_wall_get_comments' from the VK API method's parameter definitions.
    export function buildInputSchema(parameters) {
      if (!parameters || parameters.length === 0) {
        return {
          type: 'object',
          properties: {},
          additionalProperties: false,
        };
      }
    
      const properties = {};
      const required = [];
    
      for (const param of parameters) {
        properties[param.name] = convertParam(param);
        if (param.required === true) {
          required.push(param.name);
        }
      }
    
      const schema = {
        type: 'object',
        properties,
        additionalProperties: false,
      };
    
      if (required.length > 0) {
        schema.required = required;
      }
    
      return schema;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description must cover behavior. It does not mention pagination, sorting, or that empty lists can be returned. Lacks disclosure of important traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence is concise but omits key context (e.g., required parameters). Could be expanded moderately without becoming verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 12 parameters, no output schema, and no annotations, the description is too minimal. It does not explain how to use parameters or interpret results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Description adds no parameter-specific meaning beyond the input schema. With 75% schema coverage, it does not compensate for the 25% missing descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear verb 'Returns a list' and specific resource 'comments on a post on a user wall or community wall'. Distinguishes from sibling vk_wall_get_comment which returns a single comment.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives like vk_wall_get_comment or vk_photos_get_comments. Does not mention required parameters or scenario.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/ssm82/full-vk-mcp'

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