Skip to main content
Glama

search_skills

Find relevant skills by topic or keyword in the Hivemind MCP knowledge base, returning summaries to identify useful solutions.

Instructions

Search for skills by topic/keyword. Returns lightweight summaries - use get_skill() for full details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesTopic or keyword to search for (e.g., 'deployment', 'testing', 'CI/CD')

Implementation Reference

  • Primary handler function for search_skills tool. Performs HTTP POST to backend /search-skills endpoint with query, returns SkillSearchResult.
    export async function searchSkills(query: string, maxResults: number = 20): Promise<SkillSearchResult> {
      const response = await fetch(`${API_BASE}/search-skills`, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify({ query, max_results: maxResults }),
      });
    
      if (!response.ok) {
        throw new Error(`Search skills failed: ${response.statusText}`);
      }
    
      return response.json();
    }
  • MCP tool schema definition: name, description, and inputSchema requiring 'query' string parameter.
    {
      name: "search_skills",
      description:
        "Search for skills by topic/keyword. Returns lightweight summaries - use get_skill() for full details.",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "Topic or keyword to search for (e.g., 'deployment', 'testing', 'CI/CD')",
          },
        },
        required: ["query"],
      },
    },
  • MCP server CallToolRequest handler dispatches search_skills calls to searchSkills function and returns JSON response.
    case "search_skills": {
      const result = await searchSkills(args?.query as string);
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }
  • Backend Supabase edge function handler for /search-skills. Executes PostgreSQL RPC search_knowledge filtered to type='skill', maps to lightweight skill objects (id, title, category, preview, relevance), handles errors and rate limits.
    async function handleSearchSkills(supabase: any, body: any, corsHeaders: any) {
      const { query, max_results = 20 } = body;
    
      if (!query) {
        return new Response(JSON.stringify({ error: 'query parameter required' }), {
          status: 400,
          headers: { ...corsHeaders, 'Content-Type': 'application/json' }
        });
      }
    
      const startTime = performance.now();
    
      // Cap at 50 to prevent huge responses
      const cappedLimit = Math.min(max_results, 50);
    
      // Use FTS search filtered to skills only
      const { data: results, error } = await supabase.rpc('search_knowledge', {
        search_query: query,
        result_limit: cappedLimit,
        type_filter: 'skill'
      });
    
      if (error) {
        console.error('Skills search error:', error);
        return new Response(JSON.stringify({ error: 'Search failed' }), {
          status: 500,
          headers: { ...corsHeaders, 'Content-Type': 'application/json' }
        });
      }
    
      const searchTime = performance.now() - startTime;
    
      // Return lightweight summaries only (no full solutions array)
      const skills = (results || []).map((r: any) => ({
        id: r.id,
        title: r.query,
        category: r.category,
        // Just first solution as preview, not the full array
        preview: r.solutions?.[0]?.solution?.substring(0, 150) + '...' || '',
        relevance: r.search_rank ? Math.abs(r.search_rank) : 0.5
      }));
    
      return new Response(JSON.stringify({
        query,
        skills,
        total: skills.length,
        tip: skills.length > 0 ? `Use get_skill(${skills[0].id}) to see full details` : 'No matching skills found',
        query_metadata: {
          search_method: 'postgres_fts',
          search_time_ms: Math.round(searchTime * 100) / 100
        },
        _ctx: "SEARCH FIRST: Check available skills before building custom solutions."
      }), {
        headers: { ...corsHeaders, 'Content-Type': 'application/json' }
      });
    }
  • TypeScript interface defining the expected output structure of searchSkills (SkillSearchResult).
    interface SkillSearchResult {
      query: string;
      skills: Array<{
        id: number;
        title: string;
        category: string;
        preview: string;
        relevance: number;
      }>;
      total: number;
      tip: string;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses that results are 'lightweight summaries', setting expectations about the depth of the returned data and implicitly indicating that this is a non-destructive search operation. This goes beyond the schema by revealing output characteristics.

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

Conciseness5/5

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

The description is a single concise sentence with two clauses. It front-loads the action ('Search for skills') and immediately conveys the key behavioral caveat and follow-up action. Every word serves a purpose, with no redundancy or filler.

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

Completeness4/5

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

For a simple one-parameter search tool with no output schema, the description adequately covers what it does, what it returns (lightweight summaries), and what to do next (use get_skill). It does not enumerate specific result fields or pagination details, but these are less critical given the explicit pointer to get_skill for full details.

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

Parameters3/5

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

Schema description coverage is 100%, with the query parameter already clearly described as 'Topic or keyword to search for (e.g., 'deployment', 'testing', 'CI/CD')'. The description's 'by topic/keyword' adds no new meaning beyond what the schema provides, so it neither enhances nor impairs parameter understanding.

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?

The description begins with 'Search for skills by topic/keyword', which uses the specific verb 'Search' and clearly identifies the resource ('skills'). It also distinguishes from the sibling tool get_skill by noting that this returns lightweight summaries and directing users to get_skill for full details.

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

Usage Guidelines4/5

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

The description explicitly states 'use get_skill() for full details', providing a clear alternative for a specific scenario (when full details are needed). It does not discuss alternatives like search_kb or search_project, but it gives sufficient guidance for the primary decision between search_skills and get_skill.

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