Skip to main content
Glama

update_project_entry

Modify existing project-specific knowledge entries by editing query, solution, or category fields in the Hivemind MCP server.

Instructions

Update an existing project hive entry. Can edit query, solution, or category. Only works for project entries (not global hivemind KB).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idNoOptional: User ID (auto-detected from .user_id in cwd if not provided)
entry_idYesID of the entry to update (from search results)
queryNoOptional: New query text
solutionNoOptional: New solution text
categoryNoOptional: New category name
project_pathNoOptional: Project directory path (required for local storage)

Implementation Reference

  • Core handler function that executes the update_project_entry tool logic. Supports both local file-based storage (.hive.json) and cloud Supabase storage by updating the specified entry's fields (query, solution, or category). Auto-detects user_id from .user_id file.
    export async function updateProjectEntry(
      userId: string | null,
      entryId: number,
      updates: {
        query?: string;
        solution?: string;
        category?: string;
      },
      projectPath?: string
    ): Promise<{ success: boolean; message: string }> {
      // Auto-detect user_id if not provided
      if (!userId) {
        userId = await getUserId(projectPath);
        if (!userId) {
          throw new Error('No .user_id file found. Run init_hive first.');
        }
      }
    
      // Check if local storage
      if (userId.startsWith('local-') && projectPath) {
        const hive = await readLocalHive(projectPath);
        if (!hive) {
          throw new Error('Local hive not found');
        }
    
        const entryIndex = hive.entries.findIndex(e => e.id === entryId);
        if (entryIndex === -1) {
          throw new Error(`Entry ${entryId} not found in local hive`);
        }
    
        // Apply updates
        if (updates.query) hive.entries[entryIndex].query = updates.query;
        if (updates.solution) hive.entries[entryIndex].solution = updates.solution;
        if (updates.category) hive.entries[entryIndex].category = updates.category;
    
        await writeLocalHive(projectPath, hive);
    
        return {
          success: true,
          message: `Updated entry ${entryId} in local hive`
        };
      }
    
      // Cloud storage - use API
      const response = await fetch(`${API_BASE}/update-project-entry`, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          user_id: userId,
          entry_id: entryId,
          ...updates
        }),
      });
    
      if (!response.ok) {
        throw new Error(`Update entry failed: ${response.statusText}`);
      }
    
      return response.json();
    }
  • src/index.ts:482-496 (registration)
    MCP server dispatcher for the tool call. Receives parameters from MCP CallToolRequestSchema, invokes the updateProjectEntry handler, and formats response as MCP content.
    case "update_project_entry": {
      const result = await updateProjectEntry(
        args?.user_id as string,
        args?.entry_id as number,
        {
          query: args?.query as string | undefined,
          solution: args?.solution as string | undefined,
          category: args?.category as string | undefined,
        },
        args?.project_path as string | undefined
      );
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }
  • Tool schema definition including name, description, and input schema validation. Registered in ListToolsRequestHandler.
    {
      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"],
      },
    },
  • Supabase Edge Function handler for cloud storage backend. Updates the 'knowledge_entries' table row for project entries, ensuring ownership and project scope.
    async function handleUpdateProjectEntry(supabase: any, body: any, corsHeaders: any) {
      const { user_id, entry_id, query, solution, category } = body;
    
      if (!user_id || !entry_id) {
        return new Response(JSON.stringify({ error: 'user_id and entry_id required' }), {
          status: 400,
          headers: { ...corsHeaders, 'Content-Type': 'application/json' }
        });
      }
    
      // Build update object
      const updates: any = {};
      if (query !== undefined) updates.query = query;
      if (solution !== undefined) {
        // Convert solution string to JSONB array format (field name is 'solutions' plural)
        updates.solutions = [{ solution, success_rate: null, command: null, note: null }];
      }
      if (category !== undefined) updates.category = category;
    
      if (Object.keys(updates).length === 0) {
        return new Response(JSON.stringify({ error: 'No updates provided' }), {
          status: 400,
          headers: { ...corsHeaders, 'Content-Type': 'application/json' }
        });
      }
    
      // Update entry (must be owned by user AND be a project entry)
      const { data, error } = await supabase
        .from('knowledge_entries')
        .update(updates)
        .eq('id', entry_id)
        .eq('user_id', user_id)
        .not('project_id', 'is', null)  // Must be a project entry
        .select()
        .single();
    
      if (error) {
        console.error('Update entry error:', error);
        return new Response(JSON.stringify({
          success: false,
          error: error.message || 'Failed to update entry'
        }), {
          status: 500,
          headers: { ...corsHeaders, 'Content-Type': 'application/json' }
        });
      }
    
      if (!data) {
        return new Response(JSON.stringify({
          success: false,
          error: 'Entry not found or not authorized to edit'
        }), {
          status: 404,
          headers: { ...corsHeaders, 'Content-Type': 'application/json' }
        });
      }
    
      return new Response(JSON.stringify({
        success: true,
        message: `Updated entry ${entry_id}`,
        entry: data,
        _ctx: "Hive accuracy improves with edits. Keep it current for maximum value."
      }), {
        headers: { ...corsHeaders, 'Content-Type': 'application/json' }
      });
    }
Behavior2/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 of behavioral disclosure. It states it's an update operation, implying mutation, but doesn't cover critical aspects like required permissions, whether changes are reversible, error handling, or response format. The description adds minimal context beyond the basic action, leaving significant gaps for a mutation tool.

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 concise with two sentences that front-load the core action and scope. The first sentence clearly states the purpose, and the second adds important contextual limitation. There's no wasted text, though it could be slightly more structured (e.g., by explicitly listing parameters).

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?

Given the tool's complexity (mutation with 6 parameters), lack of annotations, and no output schema, the description is moderately complete. It covers the basic purpose and scope but misses behavioral details like permissions, reversibility, and response format. The schema provides good parameter documentation, but the description doesn't fully compensate for the missing behavioral context, making it adequate but with clear 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 all 6 parameters thoroughly. The description mentions that it can edit 'query, solution, or category,' which maps to three parameters, but doesn't add meaningful semantics beyond what the schema provides (e.g., it doesn't explain interactions between parameters or provide usage examples). Baseline 3 is appropriate when the schema does the heavy lifting.

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 ('Update') and resource ('existing project hive entry'), specifying what can be edited (query, solution, or category). It distinguishes this tool from potential global KB operations by stating 'Only works for project entries (not global hivemind KB).' However, it doesn't explicitly differentiate from sibling tools like 'contribute_project' or 'delete_hive' beyond the scope limitation.

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

Usage Guidelines3/5

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

The description provides some context by specifying that it only works for project entries, not global KB, which helps narrow usage. However, it doesn't explicitly state when to use this tool versus alternatives like 'contribute_project' (which might create entries) or 'delete_hive' (which might remove them), nor does it mention prerequisites or exclusions beyond the project scope.

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