Skip to main content
Glama

searchComments

Search YouTube comment collections to find relevant comments by query, with results ranked by relevance and showing author, likes, and score.

Instructions

Search imported comment collections with ranked results. Returns matching comments with author, like count, and relevance score. Uses active comment collection by default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
collectionIdNoSpecific collection to search
maxResultsNo
minScoreNo
videoIdFilterNo
useActiveCollectionNo

Implementation Reference

  • The handler for the "searchComments" tool in the MCP server, which delegates the call to the service layer.
    case "searchComments":
      return service.searchComments({
        query: readString(args, "query"),
        collectionId: optionalString(args, "collectionId"),
        maxResults: optionalNumber(args, "maxResults"),
        minScore: optionalNumber(args, "minScore"),
        videoIdFilter: optionalStringArray(args, "videoIdFilter"),
        useActiveCollection: optionalBoolean(args, "useActiveCollection"),
      });
  • The core implementation of the searchComments tool logic within the comment-knowledge-base service.
    async search(input: SearchCommentsInput): Promise<SearchCommentsOutput> {
      const startedAt = Date.now();
      const maxResults = Math.max(1, Math.min(input.maxResults ?? 10, 50));
      const minScore = Math.max(0, Math.min(input.minScore ?? 0.15, 1));
      const scope = this.resolveCollectionScope(input);
      const targetCollections = scope.searchedCollectionIds;
      const videoFilter = input.videoIdFilter
        ? new Set(input.videoIdFilter)
  • Registration of the "searchComments" tool definition in the MCP server.
      name: "searchComments",
      description: "Search imported comment collections with ranked results. Returns matching comments with author, like count, and relevance score. Uses active comment collection by default.",
      inputSchema: {
        type: "object",
        properties: {
          query: { type: "string", description: "Search query" },
          collectionId: { type: "string", description: "Specific collection to search" },
          maxResults: { type: "number", minimum: 1, maximum: 50 },
          minScore: { type: "number", minimum: 0, maximum: 1 },
          videoIdFilter: { type: "array", items: { type: "string" }, minItems: 1, maxItems: 100 },
          useActiveCollection: { type: "boolean" },
        },
        required: ["query"],
        additionalProperties: false,
      },
    },

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/rajanrengasamy/vidlens-mcp'

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