Files
mcpctl/.taskmaster/tasks/task_053.md

55 lines
1.6 KiB
Markdown
Raw Normal View History

# Task ID: 53
**Title:** Add prompt index to initialize instructions
**Status:** done
**Dependencies:** 47 ✓, 44 ✓
**Priority:** high
**Description:** Modify the initialize handler to include the compact prompt index and gate message in instructions for gated projects.
**Details:**
1. Update initialize handling in `/src/mcplocal/src/router.ts`:
```typescript
async handleInitialize(sessionId: string): Promise<InitializeResult> {
const state = this.getSessionState(sessionId);
let instructions = this.projectConfig.prompt || '';
if (state.gated) {
// Add gate instructions
const gateInstructions = await this.getSystemPrompt('gate-instructions');
// Build prompt index (cap at 50, priority 7+ if over)
const index = this.buildPromptIndex();
instructions += `\n\n${gateInstructions.replace('{{prompt_index}}', index)}`;
}
return {
protocolVersion: '2024-11-05',
capabilities: { ... },
serverInfo: { ... },
instructions,
};
}
```
2. Build prompt index with cap:
- If <= 50 prompts: include all
- If > 50 prompts: include only priority 7+
- Format: `- <name>: <summary>` (~100 chars per entry)
**Test Strategy:**
- Unit test: Gated project includes gate instructions in initialize
- Unit test: Prompt index included in instructions
- Unit test: Index capped at 50 entries
- Unit test: Over 50 prompts shows priority 7+ only
- Unit test: Non-gated project skips gate instructions
- Unit test: {{prompt_index}} template replaced
- Integration test: End-to-end initialize with gated project