Skip to main content
Glama

contribute_solution

Submit solutions to fix errors or problems in the Hivemind MCP knowledge base, helping others resolve similar technical issues.

Instructions

Submit a new solution to the hivemind knowledge base.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe error message or problem this solution solves.
solutionYesThe solution that worked.
categoryNoCategory: mcp-troubleshooting, web-automation, security, etc.

Implementation Reference

  • The core handler function that implements the contribute_solution tool. It makes a POST request to the Hivemind API's /contribute endpoint with the query, solution, and optional category, handles sensitive data rejection, and returns the result.
    export async function contributeSolution(
      query: string,
      solution: string,
      category?: string
    ): Promise<ContributeResult> {
      const response = await fetch(`${API_BASE}/contribute`, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify({ query, solution, category }),
      });
    
      if (!response.ok) {
        const errorBody = await response.json().catch(() => ({}));
        if (errorBody.detected_patterns) {
          throw new Error(`Contribution rejected: Contains sensitive data (${errorBody.detected_patterns.join(', ')}). Please remove credentials before submitting.`);
        }
        throw new Error(`Contribution failed: ${response.statusText}`);
      }
    
      return response.json();
    }
  • The input schema and description for the contribute_solution tool, defining the expected parameters: query (required), solution (required), and optional category.
    {
      name: "contribute_solution",
      description:
        "Submit a new solution to the hivemind knowledge base.",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "The error message or problem this solution solves.",
          },
          solution: {
            type: "string",
            description: "The solution that worked.",
          },
          category: {
            type: "string",
            description: "Category: mcp-troubleshooting, web-automation, security, etc.",
          },
        },
        required: ["query", "solution"],
      },
    },
  • The MCP server request handler switch case that dispatches calls to the contribute_solution tool by invoking the contributeSolution function from api.ts and formatting the response.
    case "contribute_solution": {
      const result = await contributeSolution(
        args?.query as string,
        args?.solution as string,
        args?.category as string | undefined
      );
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }
  • src/index.ts:23-352 (registration)
    The server request handler for ListToolsRequestSchema that registers the contribute_solution tool by including it in the tools list returned to MCP clients.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: "search_kb",
            description:
              "Search the hivemind knowledge base for troubleshooting solutions, error fixes, and best practices. Returns ranked solutions with success rates.",
            inputSchema: {
              type: "object",
              properties: {
                query: {
                  type: "string",
                  description:
                    "Error message, problem description, or technology to search for.",
                },
              },
              required: ["query"],
            },
          },
          {
            name: "report_outcome",
            description:
              "Report whether a solution worked or not. Helps improve solution rankings.",
            inputSchema: {
              type: "object",
              properties: {
                solution_id: {
                  type: "number",
                  description: "The ID of the solution from search results.",
                },
                outcome: {
                  type: "string",
                  enum: ["success", "failure"],
                  description: "Did the solution work?",
                },
              },
              required: ["outcome"],
            },
          },
          {
            name: "contribute_solution",
            description:
              "Submit a new solution to the hivemind knowledge base.",
            inputSchema: {
              type: "object",
              properties: {
                query: {
                  type: "string",
                  description: "The error message or problem this solution solves.",
                },
                solution: {
                  type: "string",
                  description: "The solution that worked.",
                },
                category: {
                  type: "string",
                  description: "Category: mcp-troubleshooting, web-automation, security, etc.",
                },
              },
              required: ["query", "solution"],
            },
          },
          {
            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"],
            },
          },
          {
            name: "get_skill",
            description:
              "Get detailed information about a specific skill including full instructions and executable steps.",
            inputSchema: {
              type: "object",
              properties: {
                skill_id: {
                  type: "number",
                  description: "The ID of the skill to retrieve",
                },
              },
              required: ["skill_id"],
            },
          },
          {
            name: "count_skills",
            description:
              "Get total count of skills in the database.",
            inputSchema: {
              type: "object",
              properties: {},
            },
          },
          {
            name: "init_project_kb",
            description:
              "Initialize a project-specific knowledge base with cloud storage. Returns user_id to store for future contributions. Cloud storage users get 10x rate limits (1000/hour vs 100/hour).",
            inputSchema: {
              type: "object",
              properties: {
                project_id: {
                  type: "string",
                  description: "Unique project identifier (e.g., 'hivemind-mcp', 'my-app')",
                },
                project_name: {
                  type: "string",
                  description: "Human-readable project name",
                },
                storage_type: {
                  type: "string",
                  enum: ["cloud", "local"],
                  description: "Storage type: 'cloud' (10x limits) or 'local' (default limits)",
                },
              },
              required: ["project_id", "project_name"],
            },
          },
          {
            name: "contribute_project",
            description:
              "Add knowledge to project hive. TRIGGERS: 'add to hive', 'update hive', 'contribute to hive', 'store in hive'. When user says 'update hive', analyze recent work and contribute automatically. When user says 'add to hive', ask what they want to store. Stores solutions, patterns, pitfalls, architecture decisions, etc. Private by default, optionally public. Categories are dynamic - user can create any category name.",
            inputSchema: {
              type: "object",
              properties: {
                user_id: {
                  type: "string",
                  description: "Optional: User ID (auto-detected from .user_id in cwd if not provided)",
                },
                project_id: {
                  type: "string",
                  description: "Project identifier",
                },
                query: {
                  type: "string",
                  description: "Error message or problem description",
                },
                solution: {
                  type: "string",
                  description: "What fixed it",
                },
                category: {
                  type: "string",
                  description: "Optional category (auto-detected if not provided)",
                },
                is_public: {
                  type: "boolean",
                  description: "Make this entry public (default: false/private)",
                },
                project_path: {
                  type: "string",
                  description: "Optional: Project directory path (required for local storage)",
                },
              },
              required: ["project_id", "query", "solution"],
            },
          },
          {
            name: "search_project",
            description:
              "Search project hive for knowledge. TRIGGERS: 'search my hive for [topic]', 'search hive [query]', 'find in hive [topic]', 'what does my hive know about [topic]'. Searches your private entries + optionally public entries. Returns relevant solutions, patterns, architecture decisions, etc.",
            inputSchema: {
              type: "object",
              properties: {
                user_id: {
                  type: "string",
                  description: "Optional: User ID (auto-detected from .user_id in cwd if not provided)",
                },
                query: {
                  type: "string",
                  description: "Search query",
                },
                project_id: {
                  type: "string",
                  description: "Optional: limit to specific project",
                },
                include_public: {
                  type: "boolean",
                  description: "Include public entries in results (default: true)",
                },
                project_path: {
                  type: "string",
                  description: "Optional: Project directory path (required for local storage)",
                },
              },
              required: ["query"],
            },
          },
          {
            name: "init_hive",
            description:
              "Create a new project hive (knowledge base). TRIGGERS: 'create a new hive', 'start a hive', 'initialize hive'. Onboarding flow: First call checks if user ever used Hivemind before. If first time, asks 'Is this your first time using Claude Code?' If yes, creates CLAUDE.md with starter config. Then guides through storage choice (cloud/local). If no project_path provided, creates empty hive with starter categories. IMPORTANT: Display the 'message' field to the user EXACTLY as returned - do not condense, reformat, or summarize it.",
            inputSchema: {
              type: "object",
              properties: {
                project_id: {
                  type: "string",
                  description: "Project identifier (e.g., from package.json name or directory)",
                },
                project_name: {
                  type: "string",
                  description: "Human-readable project name",
                },
                is_first_time_user: {
                  type: "boolean",
                  description: "Answer to 'Is this your first time using Claude Code?' (only used when onboarding flag not set)",
                },
                storage_choice: {
                  type: "string",
                  enum: ["cloud", "local"],
                  description: "User's storage choice (omit on first call to get options)",
                },
                project_path: {
                  type: "string",
                  description: "Optional: Absolute path to project directory (for scanning). If not provided, creates empty hive with starter categories only.",
                },
              },
              required: ["project_id", "project_name"],
            },
          },
          {
            name: "delete_hive",
            description:
              "Delete project hive and all associated knowledge entries. Use this to start fresh or remove a project's knowledge base completely.",
            inputSchema: {
              type: "object",
              properties: {
                user_id: {
                  type: "string",
                  description: "Optional: User ID (auto-detected from .user_id in cwd if not provided)",
                },
                project_id: {
                  type: "string",
                  description: "Project identifier to delete",
                },
                project_path: {
                  type: "string",
                  description: "Optional: Project directory path (required for local storage)",
                },
              },
              required: ["project_id"],
            },
          },
          {
            name: "get_hive_overview",
            description:
              "Get overview of project hive including total entries, category breakdown, and recent additions. Use when user says 'show me my hive' or 'hive overview'.",
            inputSchema: {
              type: "object",
              properties: {
                user_id: {
                  type: "string",
                  description: "Optional: User ID (auto-detected from .user_id in cwd if not provided)",
                },
                project_id: {
                  type: "string",
                  description: "Project identifier",
                },
                project_path: {
                  type: "string",
                  description: "Optional: Project directory path (required for local storage)",
                },
              },
              required: ["project_id"],
            },
          },
          {
            name: "update_project_entry",
            description:
              "Update an existing project hive entry. Can edit query, solution, or category. Only works for project entries (not global hivemind KB).",
            inputSchema: {
              type: "object",
              properties: {
                user_id: {
                  type: "string",
                  description: "Optional: User ID (auto-detected from .user_id in cwd if not provided)",
                },
                entry_id: {
                  type: "number",
                  description: "ID of the entry to update (from search results)",
                },
                query: {
                  type: "string",
                  description: "Optional: New query text",
                },
                solution: {
                  type: "string",
                  description: "Optional: New solution text",
                },
                category: {
                  type: "string",
                  description: "Optional: New category name",
                },
                project_path: {
                  type: "string",
                  description: "Optional: Project directory path (required for local storage)",
                },
              },
              required: ["entry_id"],
            },
          },
          {
            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"],
            },
          },
        ],
      };
    });
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states 'Submit a new solution' but lacks details on behavioral traits such as permissions required, whether this is a write operation, potential side effects, or response format. This leaves significant gaps for a mutation tool with zero annotation coverage.

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, efficient sentence that directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, making it easy to understand quickly.

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 the tool involves mutation (submitting new content) with no annotations and no output schema, the description is incomplete. It does not address key aspects like success indicators, error handling, or integration with the knowledge base, leaving the agent with insufficient context for reliable use.

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 all three parameters. The description does not add any meaning beyond the schema, such as examples or constraints not captured in the property descriptions. Baseline 3 is appropriate when the schema handles the parameter documentation adequately.

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

Purpose4/5

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

The description clearly states the action ('Submit') and resource ('new solution to the hivemind knowledge base'), making the purpose evident. However, it does not explicitly differentiate from sibling tools like 'search_kb' or 'update_project_entry', which could involve similar knowledge base interactions, so it misses full sibling distinction.

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?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'search_kb' for retrieval or 'update_project_entry' for modifications, there is no indication of prerequisites, exclusions, or context for choosing this submission tool over others.

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