Skip to content

Commit c8e479e

Browse files
committed
mcp update
1 parent 893fe33 commit c8e479e

4 files changed

Lines changed: 50 additions & 3 deletions

File tree

framework/docs/FRAMEWORK_GUIDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ Runs **in Node.js** during build (via `vite.framework-dev.config.js` `closeBundl
664664
665665
### MCP `coursecode_lint` — Build-Time Only
666666
667-
The MCP `coursecode_lint` tool runs the build linter (config validation, CSS class verification, structure checks). It does NOT include runtime errors. For runtime errors, contrast warnings, and other dynamic issues, use `coursecode_state` which returns `frameworkLogs` and `errors` from the preview server.
667+
The MCP `coursecode_lint` tool runs the build linter (config validation, CSS class verification, structure checks). It does NOT include runtime errors. For runtime errors and contrast warnings, use `coursecode_errors` (lightweight — just errors and console logs) or `coursecode_state` (full state snapshot including errors).
668668
669669
### Shared Rules (`lib/validation-rules.js`)
670670
@@ -873,6 +873,7 @@ If the preview is not running, runtime tools fail fast with a clear error messag
873873
| Tool | Purpose | Returns |
874874
|------|---------|--------|
875875
| `coursecode_state` | Full course snapshot | `{slide, toc, interactions, engagement, lmsState, apiLog, errors, frameworkLogs, consoleLogs}` |
876+
| `coursecode_errors` | Errors + console logs only | `{errors, consoleLogs, count, clean}` — same error sources as `coursecode_state`, without the state payload |
876877
| `coursecode_navigate` | Go to slide by ID | `{slide, interactions, engagement, accessibility}` |
877878
| `coursecode_interact` | Set response + evaluate | `{interactionId, response}` → `{correct, score, feedback}` |
878879
| `coursecode_screenshot` | Visual capture (JPEG) | Optional `slideId` to navigate first, `fullPage` for scroll capture |

lib/mcp-prompts.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,29 @@ Returns:
3434
- consoleLogs: browser console warnings/errors [{type, text, time}]
3535
3636
Use this first to understand the course state before taking actions.
37+
For error checking only (after file edits), prefer coursecode_errors — same error sources, smaller payload.
38+
Requires preview server to be running.`,
39+
inputSchema: {
40+
type: 'object',
41+
properties: {},
42+
required: []
43+
},
44+
annotations: {
45+
readOnlyHint: true,
46+
idempotentHint: true
47+
}
48+
},
49+
{
50+
name: 'coursecode_errors',
51+
description: `Get runtime errors and warnings from the live preview. Uses the same error sources as coursecode_state (preview server errors + browser console) but without the heavyweight state payload.
52+
53+
Returns:
54+
- errors: [{type, message, hint?, isWarning?}] — preview server errors and warnings
55+
- consoleLogs: [{type, text, time}] — browser console warnings/errors
56+
- count: total number of errors + console logs
57+
- clean: true if no errors, warnings, or console issues
58+
59+
Use after making file changes to check for breakage without the overhead of coursecode_state.
3760
Requires preview server to be running.`,
3861
inputSchema: {
3962
type: 'object',
@@ -406,7 +429,6 @@ Use to discover available icons before authoring slides or configuring menus.`,
406429
readOnlyHint: true,
407430
idempotentHint: true
408431
}
409-
},
410432

411433
];
412434

lib/mcp-server.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,30 @@ export async function startMcpServer(options = {}) {
231231
}
232232
break;
233233

234+
case 'coursecode_errors': {
235+
// Same error-gathering mechanism as coursecode_state,
236+
// but without the heavyweight state payload (TOC, interactions, etc.)
237+
await ensureHeadless(port);
238+
let errors = [];
239+
try {
240+
const errResp = await fetch(`http://localhost:${port}/__lms/errors`);
241+
if (errResp.ok) {
242+
const errData = await errResp.json();
243+
errors = [...(errData.errors || []), ...(errData.warnings || [])];
244+
}
245+
} catch {
246+
// Preview server unreachable — errors array stays empty
247+
}
248+
const consoleLogs = headless.getConsoleLogs();
249+
result = {
250+
errors,
251+
consoleLogs,
252+
count: errors.length + consoleLogs.length,
253+
clean: errors.length === 0 && consoleLogs.length === 0
254+
};
255+
break;
256+
}
257+
234258
// === Workflow & build tools ===
235259
case 'coursecode_workflow_status':
236260
result = await getWorkflowStatusWithInstructions(port);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coursecode",
3-
"version": "0.1.31",
3+
"version": "0.1.32",
44
"description": "Multi-format course authoring framework with CLI tools (SCORM 2004, SCORM 1.2, cmi5, LTI 1.3)",
55
"type": "module",
66
"bin": {

0 commit comments

Comments
 (0)