Skip to main content
Glama

list_my_hives

Retrieve your project hives with details including project names, IDs, and entry counts from the Hivemind MCP knowledge base.

Instructions

List all project hives for a user. TRIGGERS: 'show me my hives', 'list my hives', 'what hives do I have', 'all my hives'. Returns project_id, project_name, and entry count for each hive. For local storage, searches current directory for .user_id files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idYesUser ID to list hives for
project_pathNoOptional: Project directory path (for local storage)

Implementation Reference

  • Tool schema definition: input validation schema, description, and triggers for the list_my_hives MCP tool.
    {
      name: "list_my_hives",
      description:
        "List all project hives for a user. TRIGGERS: 'show me my hives', 'list my hives', 'what hives do I have', 'all my hives'. Returns project_id, project_name, and entry count for each hive. For local storage, searches current directory for .user_id files.",
      inputSchema: {
        type: "object",
        properties: {
          user_id: {
            type: "string",
            description: "User ID to list hives for",
          },
          project_path: {
            type: "string",
            description: "Optional: Project directory path (for local storage)",
          },
        },
        required: ["user_id"],
      },
    },
  • MCP server tool handler: switch case that calls listMyHives function and returns JSON response.
    case "list_my_hives": {
      const result = await listMyHives(
        args?.user_id as string,
        args?.project_path as string | undefined
      );
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }
  • Core implementation of listMyHives: handles local/cloud storage, calls Supabase public API endpoint for cloud hives listing.
    export async function listMyHives(
      userId: string,
      projectPath?: string
    ): Promise<{
      success: boolean;
      hives: Array<{ project_id: string; project_name: string; entry_count: number }>;
    }> {
      // Check if local storage
      if (userId.startsWith('local-')) {
        // For local storage, would need to scan filesystem for .hive.json files
        // Not implemented yet - return empty for now
        return {
          success: true,
          hives: []
        };
      }
    
      // Cloud storage - use API
      const response = await fetch(`${API_BASE}/list-my-hives`, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          user_id: userId
        }),
      });
    
      if (!response.ok) {
        throw new Error(`List hives failed: ${response.statusText}`);
      }
    
      return response.json();
    }
  • Backend Supabase edge function handler: queries knowledge_entries table, groups by project_id, counts entries per hive for the user.
    async function handleListMyHives(supabase: any, body: any, corsHeaders: any) {
      const { user_id } = body;
    
      if (!user_id) {
        return new Response(JSON.stringify({ error: 'user_id required' }), {
          status: 400,
          headers: { ...corsHeaders, 'Content-Type': 'application/json' }
        });
      }
    
      // Query to get all projects for this user with entry counts
      const { data, error } = await supabase
        .from('knowledge_entries')
        .select('project_id, project_name')
        .eq('user_id', user_id)
        .not('project_id', 'is', null);
    
      if (error) {
        console.error('List hives error:', error);
        return new Response(JSON.stringify({
          success: false,
          error: error.message || 'Failed to list hives'
        }), {
          status: 500,
          headers: { ...corsHeaders, 'Content-Type': 'application/json' }
        });
      }
    
      // Group by project_id and count entries
      const projectMap = new Map<string, { project_name: string; count: number }>();
    
      for (const entry of data || []) {
        const key = entry.project_id;
        if (!projectMap.has(key)) {
          projectMap.set(key, { project_name: entry.project_name, count: 0 });
        }
        projectMap.get(key)!.count++;
      }
    
      // Convert to array
      const hives = Array.from(projectMap.entries()).map(([project_id, info]) => ({
        project_id,
        project_name: info.project_name,
        entry_count: info.count
      }));
    
      return new Response(JSON.stringify({
        success: true,
        hives,
        _ctx: "Each hive = separate project brain. Bigger hives = faster development on that project."
      }), {
        headers: { ...corsHeaders, 'Content-Type': 'application/json' }
      });
    }
  • Supabase public gateway endpoint registration: routes POST /list-my-hives to handleListMyHives function.
    case 'list-my-hives':
      return await handleListMyHives(supabase, body, corsHeaders);
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool returns specific fields (project_id, name, entry count) and mentions local storage behavior (searching for .user_id files), which adds useful context. However, it doesn't cover permissions, rate limits, or error handling.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded with the core purpose. The trigger examples and local storage note add value without redundancy. However, the trigger list could be slightly condensed.

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

Completeness3/5

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

For a read-only list tool with no annotations and no output schema, the description adequately covers purpose and basic behavior. It mentions return fields and local storage context, but lacks details on pagination, error cases, or response format, leaving some gaps.

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%, so the schema already documents both parameters. The description adds marginal value by mentioning 'for local storage' in relation to project_path, but doesn't provide additional syntax or format details beyond what the schema provides.

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 clearly states the specific action ('List all project hives for a user') and resource ('project hives'), distinguishing it from siblings like 'get_hive_overview' (detailed view) or 'delete_hive' (destructive action). It also specifies the scope ('for a user') and output fields.

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 provides clear context for when to use this tool (e.g., triggered by phrases like 'show me my hives'), but doesn't explicitly state when not to use it or name alternatives among siblings. It implies usage for listing user hives versus other hive-related operations.

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/Kevthetech143/hivemind-mcp'

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