Incorrect MCP Tool Names in Hive Mind Prompts
- Dominant language
- TypeScript
- Stars
- 72.7k
- Forks
- 8.6k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 83
Description
# Bug Report: Incorrect MCP Tool Names in Hive Mind Prompts
## Summary
The `claude-flow` hive mind system generates session prompts containing incorrect MCP tool names that do not exist in the actual MCP server implementation. Specifically, it references `memory_store`, `memory_retrieve` as separate tools, when the actual implementation uses `memory_usage` with an `action` parameter.
## Impact
- **Severity**: High
- **Affected Users**: All users of `npx claude-flow@alpha hive-mind spawn`
- **Symptoms**:
- Tool invocation errors: `Error: No such tool available: mcp__claude-flow__memory_store`
- Agent coordination failures due to inability to store/retrieve shared memory
- Hive mind collective intelligence features are non-functional
- No cross-agent knowledge sharing possible
## Environment
- **Package**: `claude-flow@alpha` (v2.7.0-alpha.10 and likely earlier versions)
- **Command**: `npx claude-flow@alpha hive-mind spawn "objective"`
- **Repository**: https://github.com/ruvnet/claude-flow
- **Local Investigation**: Alpha 10 source code at commit: (latest)
## Root Cause
The hive mind prompt template in `/src/cli/simple-commands/hive-mind.js` hardcodes incorrect MCP tool names using JavaScript template literals, rather than dynamically querying the actual available tools from the MCP server.
## Evidence from Source Code
### 1. Buggy Code: Incorrect Tool Names in Prompt Template
**File**: `/src/cli/simple-commands/hive-mind.js`
**Lines**: 2287-2290, 2301-2302
```javascript
5️⃣ **MEMORY & LEARNING**
mcp__claude-flow__memory_store - Store collective knowledge
mcp__claude-flow__memory_retrieve - Access shared memory
```
**Usage Examples in Same File** (lines 2301-2302):
```javascript
mcp__claude-flow__memory_store { "key": "hive/objective", "value": "${objective}" }
mcp__claude-flow__memory_store { "key": "hive/queen", "value": "${queenType}" }
```
### 2. Correct Tool Definition in MCP Server
**File**: `/src/mcp/mcp-server.js`
**Lines**: 224-238
```javascript
memory_usage: {
name: 'memory_usage',
description: 'Store/retrieve persistent memory with TTL and namespacing',
inputSchema: {
type: 'object',
properties: {
action: { type: 'string', enum: ['store', 'retrieve', 'list', 'delete', 'search'] },
key: { type: 'string' },
value: { type: 'string' },
namespace: { type: 'string', default: 'default' },
ttl: { type: 'number' },
},
required: ['action'],
},
},
```
### 3. Correct Documentation
**File**: `/docs/reference/MCP_TOOLS.md`
**Lines**: 462-480
```markdown
#### `mcp__claude-flow__memory_usage`
**Function**: Store and retrieve data in persistent memory with namespace support
**Parameters**:
- `action` (string): Action type - "store", "retrieve", "delete"
- `key` (string): Memory key
- `value` (any, for store): Data to store
- `namespace` (string, optional): Memory namespace
- `type` (string, optional): Data type - "knowledge", "config", "metrics", "state"
**Usage Example**:
```json
{
"action": "store",
"key": "project_requirements",
"value": {"features": ["auth", "dashboard"], "deadline": "2024-02-01"},
"namespace": "project-alpha",
"type": "knowledge"
}
```
```
## Discrepancy Analysis
| What Hive Mind Claims | What Actually Exists | Status |
|----------------------|---------------------|---------|
| `mcp__claude-flow__memory_store` | Does NOT exist | ❌ ERROR |
| `mcp__claude-flow__memory_retrieve` | Does NOT exist | ❌ ERROR |
| N/A | `mcp__claude-flow__memory_usage` with `action: "store"` | ✅ CORRECT |
| N/A | `mcp__claude-flow__memory_usage` with `action: "retrieve"` | ✅ CORRECT |
## Reproduction Steps
1. Install `claude-flow@alpha`:
```bash
npm install -g claude-flow@alpha
```
2. Initialize hive mind:
```bash
npx claude-flow@alpha hive-mind init
```
3. Spawn a swarm:
```bash
npx claude-flow@alpha hive-mind spawn "test objective"
```
4. Check generated session prompt:
```bash
cat .hive-mind/sessions/hive-mind-prompt-swarm-*.txt
```
5. Observe that prompt contains:
```
mcp__claude-flow__memory_store - Store collective knowledge
mcp__claude-flow__memory_retrieve - Access shared memory
```
6. Attempt to use the tool from a Claude Code session:
```javascript
mcp__claude-flow__memory_store({ key: "test", value: "data" })
```
7. **Expected Result**: Tool executes successfully
8. **Actual Result**: `Error: No such tool available: mcp__claude-flow__memory_store`
## Correct Usage
The correct invocations should be:
```javascript
// Instead of memory_store
mcp__claude-flow__memory_usage({
action: "store",
key: "hive/objective",
value: "Fix bugs"
})
// Instead of memory_retrieve
mcp__claude-flow__memory_usage({
action: "retrieve",
key: "hive/objective"
})
```
## Reproduction Confirmation
**Test Performed**: 2025-10-16 05:04:39 UTC
### Environment
- **Package Version**: `claude-flow@alpha` v2.7.0-alpha.10
- **Node Version**: v22.20.0
- **Platform**: WSL2 Ubuntu on Windows
### Reproduction Results
#### ✅ Step 1: Installation Verified
```bash
$ npx claude-flow@alpha --version
v2.7.0-alpha.10
```
#### ✅ Step 2: Hive Mind Initialization Confirmed
```bash
$ ls -la .hive-mind/config.json
-rwxrwxrwx 1 lu lu 2344 Oct 15 22:36 .hive-mind/config.json
```
#### ✅ Step 3: Test Swarm Spawned
```bash
$ npx claude-flow@alpha hive-mind spawn "Bug reproduction test for incorrect MCP tool names" --workers 2
Swarm ID: swarm-1760591001422-g62i8ctv7
Session ID: session-1760591001432-7s98p8kh3
Workers: 4 (researcher, coder, analyst, tester)
Status: ✓ Active
```
#### ✅ Step 4: Incorrect Tool Names Found in Session Prompt
**File**: `.hive-mind/sessions/hive-mind-prompt-swarm-1760588115903-k94esvtsz.txt`
```bash
$ grep -n "memory_store\|memory_retrieve\|pattern_recognize" .hive-mind/sessions/hive-mind-prompt-swarm-*.txt
52: mcp__claude-flow__memory_store - Store collective knowledge
53: mcp__claude-flow__memory_retrieve - Access shared memory
55: mcp__claude-flow__pattern_recognize - Identify patterns
73: mcp__claude-flow__memory_store { "key": "hive/objective", "value": "..." }
74: mcp__claude-flow__memory_store { "key": "hive/queen", "value": "..." }
```
#### ✅ Step 5: Tool Invocation Error Confirmed
**Attempted Tool**: `mcp__claude-flow__memory_store`
```javascript
mcp__claude-flow__memory_store({ key: "test_key", value: "test_value" })
```
**Result**:
```
❌ Error: No such tool available: mcp__claude-flow__memory_store
```
#### ✅ Step 6: Correct Tool Works as Expected
**Correct Tool**: `mcp__claude-flow__memory_usage` with `action` parameter
**Store Test**:
```javascript
mcp__claude-flow__memory_usage({
action: "store",
key: "test_key",
value: "test_value_reproduction_confirmed",
namespace: "bug-reproduction"
})
```
**Result**:
```json
{
"success": true,
"action": "store",
"key": "test_key",
"namespace": "bug-reproduction",
"stored": true,
"size": 33,
"id": 3044,
"storage_type": "sqlite",
"timestamp": "2025-10-16T05:04:39.545Z"
}
```
**Retrieve Test**:
```javascript
mcp__claude-flow__memory_usage({
action: "retrieve",
key: "test_key",
namespace: "bug-reproduction"
})
```
**Result**:
```json
{
"success": true,
"action": "retrieve",
"key": "test_key",
"value": "test_value_reproduction_confirmed",
"found": true,
"namespace": "bug-reproduction",
"storage_type": "sqlite",
"timestamp": "2025-10-16T05:04:39.622Z"
}
```
### Conclusion
**Bug Status**: ✅ **CONFIRMED AND REPRODUCIBLE**
1. ❌ `mcp__claude-flow__memory_store` does NOT exist
2. ❌ `mcp__claude-flow__memory_retrieve` does NOT exist
4. ✅ `mcp__claude-flow__memory_usage` with `action: "store"` WORKS
5. ✅ `mcp__claude-flow__memory_usage` with `action: "retrieve"` WORKS
The bug is **100% reproducible** on `claude-flow@alpha` v2.7.0-alpha.10.
Contributor guide
Research direction
Start in src/cli/simple-commands/hive-mind.js at the prompt template and usage examples around lines 2287-2302. Compare the referenced tools with memory_usage in src/mcp/mcp-server.js and its documentation in docs/reference/MCP_TOOLS.md. Done means generated Hive Mind prompts reference the available memory_usage tool with the appropriate action values and no invalid memory tool names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100