50 lines
1.5 KiB
Markdown
50 lines
1.5 KiB
Markdown
|
|
# Task ID: 83
|
||
|
|
|
||
|
|
**Title:** Implement Section Drill-Down for Prompts
|
||
|
|
|
||
|
|
**Status:** cancelled
|
||
|
|
|
||
|
|
**Dependencies:** 82 ✓
|
||
|
|
|
||
|
|
**Priority:** high
|
||
|
|
|
||
|
|
**Description:** Extend read_prompts to support section parameter for drilling into specific sections produced by proxymodel stages.
|
||
|
|
|
||
|
|
**Details:**
|
||
|
|
|
||
|
|
Modify the read_prompts handler in `src/mcplocal/src/router.ts`:
|
||
|
|
|
||
|
|
```typescript
|
||
|
|
// In the read_prompts tool handler
|
||
|
|
if (args.section) {
|
||
|
|
// Look up section in the processed result
|
||
|
|
const sectionId = args.section;
|
||
|
|
const cachedResult = this.sectionCache.get(promptName);
|
||
|
|
if (cachedResult?.sections) {
|
||
|
|
const section = findSection(cachedResult.sections, sectionId);
|
||
|
|
if (section) {
|
||
|
|
return { content: [{ type: 'text', text: section.content }] };
|
||
|
|
}
|
||
|
|
return { content: [{ type: 'text', text: `Section '${sectionId}' not found` }], isError: true };
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Helper to find section by ID (supports nested sections)
|
||
|
|
function findSection(sections: Section[], id: string): Section | null {
|
||
|
|
for (const s of sections) {
|
||
|
|
if (s.id === id) return s;
|
||
|
|
if (s.sections) {
|
||
|
|
const nested = findSection(s.sections, id);
|
||
|
|
if (nested) return nested;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
Also add a sectionCache Map to store processed results with their sections for drill-down.
|
||
|
|
|
||
|
|
**Test Strategy:**
|
||
|
|
|
||
|
|
Integration tests: read_prompts with section parameter returns correct section content, nested section lookup works, missing section returns error, section cache populated after initial processing.
|