@curenorway/kode-mcp 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +49 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -252,13 +252,21 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
252
252
|
},
|
|
253
253
|
{
|
|
254
254
|
name: "kode_get_script",
|
|
255
|
-
description: "Get
|
|
255
|
+
description: "Get a script by its slug or ID. By default returns full content. Use includeContent:false to get just metadata (saves context tokens for large scripts).",
|
|
256
256
|
inputSchema: {
|
|
257
257
|
type: "object",
|
|
258
258
|
properties: {
|
|
259
259
|
slug: {
|
|
260
260
|
type: "string",
|
|
261
261
|
description: 'Script slug (e.g., "init", "tracking") or script ID (UUID)'
|
|
262
|
+
},
|
|
263
|
+
includeContent: {
|
|
264
|
+
type: "boolean",
|
|
265
|
+
description: "Include full script content. Default: true. Set to false to get just metadata (name, type, scope, version, size) - useful for large scripts."
|
|
266
|
+
},
|
|
267
|
+
contentPreview: {
|
|
268
|
+
type: "number",
|
|
269
|
+
description: "If set, include only the first N characters of content. Useful for previewing large scripts without loading everything."
|
|
262
270
|
}
|
|
263
271
|
},
|
|
264
272
|
required: ["slug"]
|
|
@@ -597,7 +605,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
597
605
|
};
|
|
598
606
|
}
|
|
599
607
|
case "kode_get_script": {
|
|
600
|
-
const { slug } = args;
|
|
608
|
+
const { slug, includeContent = true, contentPreview } = args;
|
|
601
609
|
const scripts = await client.listScripts(siteId);
|
|
602
610
|
const script = scripts.find((s) => s.slug === slug || s.id === slug);
|
|
603
611
|
if (!script) {
|
|
@@ -606,6 +614,44 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
606
614
|
isError: true
|
|
607
615
|
};
|
|
608
616
|
}
|
|
617
|
+
const contentLength = script.content?.length || 0;
|
|
618
|
+
const estimatedTokens = Math.ceil(contentLength / 4);
|
|
619
|
+
if (!includeContent && !contentPreview) {
|
|
620
|
+
return {
|
|
621
|
+
content: [
|
|
622
|
+
{
|
|
623
|
+
type: "text",
|
|
624
|
+
text: `Script: ${script.name}
|
|
625
|
+
Slug: ${script.slug}
|
|
626
|
+
Type: ${script.type}
|
|
627
|
+
Scope: ${script.scope}
|
|
628
|
+
Version: ${script.current_version}
|
|
629
|
+
Auto-load: ${script.auto_load ? "yes" : "no"}
|
|
630
|
+
Size: ${contentLength} chars (~${estimatedTokens} tokens)
|
|
631
|
+
|
|
632
|
+
Use includeContent:true or contentPreview:N to fetch content.`
|
|
633
|
+
}
|
|
634
|
+
]
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
if (contentPreview && contentPreview > 0) {
|
|
638
|
+
const preview = script.content?.slice(0, contentPreview) || "";
|
|
639
|
+
const isTruncated = contentLength > contentPreview;
|
|
640
|
+
return {
|
|
641
|
+
content: [
|
|
642
|
+
{
|
|
643
|
+
type: "text",
|
|
644
|
+
text: `// Script: ${script.name} (${script.type})
|
|
645
|
+
// Version: ${script.current_version}
|
|
646
|
+
// Scope: ${script.scope}
|
|
647
|
+
// Size: ${contentLength} chars (~${estimatedTokens} tokens)${isTruncated ? `
|
|
648
|
+
// Showing first ${contentPreview} chars` : ""}
|
|
649
|
+
|
|
650
|
+
${preview}${isTruncated ? "\n\n// ... (truncated) - use includeContent:true for full content" : ""}`
|
|
651
|
+
}
|
|
652
|
+
]
|
|
653
|
+
};
|
|
654
|
+
}
|
|
609
655
|
return {
|
|
610
656
|
content: [
|
|
611
657
|
{
|
|
@@ -613,6 +659,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
613
659
|
text: `// Script: ${script.name} (${script.type})
|
|
614
660
|
// Version: ${script.current_version}
|
|
615
661
|
// Scope: ${script.scope}
|
|
662
|
+
// Size: ${contentLength} chars (~${estimatedTokens} tokens)
|
|
616
663
|
|
|
617
664
|
${script.content}`
|
|
618
665
|
}
|