mirror of
https://github.com/bendtherules/ask262.git
synced 2026-08-18 13:21:55 +00:00
getSectionContent - allow multiple sectionids
This commit is contained in:
+10
-6
@@ -113,13 +113,17 @@ async function createMcpServer() {
|
||||
openWorldHint: false,
|
||||
},
|
||||
},
|
||||
async ({ sectionId, recursive }) => {
|
||||
async ({ sectionIds, recursive }) => {
|
||||
console.log(
|
||||
`[TOOL] ${sectionContentToolName}: sectionId="${sectionId}" recursive=${recursive}`,
|
||||
`[TOOL] ${sectionContentToolName}: sectionIds=[${sectionIds.map((id: string) => `"${id}"`).join(", ")}] recursive=${recursive}`,
|
||||
);
|
||||
const result = await getSectionContentTool({ sectionIds, recursive });
|
||||
const totalContentLength = result.sections.reduce(
|
||||
(sum: number, s: { content: string }) => sum + s.content.length,
|
||||
0,
|
||||
);
|
||||
const result = await getSectionContentTool({ sectionId, recursive });
|
||||
console.log(
|
||||
`[TOOL] ${sectionContentToolName}: ${result.content.length} chars, ${result.sectionCount} sections`,
|
||||
`[TOOL] ${sectionContentToolName}: ${totalContentLength} chars, ${result.sections.length} sections`,
|
||||
);
|
||||
return {
|
||||
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
||||
@@ -200,14 +204,14 @@ I'll use one of these orchestration patterns:
|
||||
PATTERN 1 - For "What happens when I run this code?" questions:
|
||||
- Use ask262Debug.startImportant() and ask262Debug.stopImportant() in the code to mark only important sections.
|
||||
- STEP 1: ask262_evaluate_in_engine262(code: markedCode)
|
||||
- STEP 2: ask262_get_section_content(sectionId: importantSections[0], recursive: true)
|
||||
- STEP 2: ask262_get_section_content(sectionIds: ["sec-1", "sec-2"], recursive: true)
|
||||
- Explain which spec sections were hit and why
|
||||
|
||||
PATTERN 2 - For "How does X work?" questions (e.g., "${question}"):
|
||||
- Flow A: Generate a specific code example and follow Pattern 1
|
||||
- Flow B: If no code example possible, search broadly:
|
||||
* STEP 1: ask262_search_spec_sections(query: relevant keywords from "${question}")
|
||||
* STEP 2: ask262_get_section_content(sectionId: foundSectionId, recursive: true)
|
||||
* STEP 2: ask262_get_section_content(sectionIds: ["sec-1", "sec-2"], recursive: true)
|
||||
|
||||
I prefer Pattern 1 when possible as it provides exact spec sections through execution.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user