Skip to content

Commit 48ab4f3

Browse files
authored
Merge pull request #74 from decocms/feat/prompts-by-bindings
use prompts binding on deps
2 parents 0beaea9 + 91aa892 commit 48ab4f3

File tree

3 files changed

+7
-74
lines changed

3 files changed

+7
-74
lines changed

bun.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"name": "mcp-studio",
9999
"version": "1.0.0",
100100
"dependencies": {
101-
"@decocms/bindings": "1.0.1-alpha.26",
101+
"@decocms/bindings": "1.0.1-alpha.27",
102102
"@decocms/mcps-shared": "1.0.0",
103103
"@decocms/runtime": "1.0.0-alpha.42",
104104
"@radix-ui/react-collapsible": "^1.1.12",
@@ -650,7 +650,7 @@
650650

651651
"@deco/mcp": ["@jsr/[email protected]", "https://npm.jsr.io/~/11/@jsr/deco__mcp/0.5.5.tgz", { "dependencies": { "@jsr/deco__deco": "^1.112.1", "@jsr/hono__hono": "^4.5.4", "@modelcontextprotocol/sdk": "^1.11.4", "fetch-to-node": "^2.1.0", "zod": "^3.24.2" } }, "sha512-46TaWGu7lbsPleHjCVrG6afhQjv3muBTNRFBkIhLrSzlQ+9d21UeukpYs19z0AGpOlmjSSK9qIRFTf8SlH2B6Q=="],
652652

653-
"@decocms/bindings": ["@decocms/[email protected].26", "", { "dependencies": { "@modelcontextprotocol/sdk": "1.20.2", "zod": "^3.25.76", "zod-from-json-schema": "^0.0.5" } }, "sha512-i6WlXYKL61PDkxBbPaA1NNvezqxa7CW6wPaRBZueAuEUxBcDSeOTs4DE6LWjzWz7TpsUg4fD72Ov3IEk7S1nVA=="],
653+
"@decocms/bindings": ["@decocms/[email protected].27", "", { "dependencies": { "@modelcontextprotocol/sdk": "1.20.2", "zod": "^3.25.76", "zod-from-json-schema": "^0.0.5" } }, "sha512-0usZaDC5wKMT+aoLV/H8jDLJkuT0lVHWrXGR7AoAJ0A6eEZCCuXu3G4/Yoo8xR5uYjv2MjEw2Xbf4GnVS2Rttg=="],
654654

655655
"@decocms/mcps-shared": ["@decocms/mcps-shared@workspace:shared"],
656656

mcp-studio/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"publish": "cat app.json | deco registry publish -w /shared/deco -y"
1515
},
1616
"dependencies": {
17-
"@decocms/bindings": "1.0.1-alpha.26",
17+
"@decocms/bindings": "1.0.1-alpha.27",
1818
"@decocms/runtime": "1.0.0-alpha.42",
1919
"@decocms/mcps-shared": "1.0.0",
2020
"@radix-ui/react-collapsible": "^1.1.12",

mcp-studio/server/tools/prompt.ts

Lines changed: 4 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
*/
1111

1212
import {
13-
BaseCollectionEntitySchema,
1413
CollectionGetInputSchema,
15-
createCollectionBindings,
1614
createCollectionGetOutputSchema,
1715
} from "@decocms/bindings/collections";
16+
import {
17+
PROMPTS_COLLECTION_BINDING,
18+
PromptSchema,
19+
} from "@decocms/bindings/prompt";
1820
import { createPrivateTool } from "@decocms/runtime/tools";
1921
import { z, type ZodType } from "zod";
2022
import { runSQL } from "../lib/postgres.ts";
@@ -30,75 +32,6 @@ import type { Env } from "../main.ts";
3032
// Schemas (following MCP Prompts specification)
3133
// ============================================================================
3234

33-
/**
34-
* Schema for prompt arguments that can be passed when getting a prompt
35-
*/
36-
const PromptArgumentSchema = z.object({
37-
name: z.string().describe("Argument name"),
38-
description: z.string().optional().describe("Argument description"),
39-
required: z.boolean().optional().describe("Whether argument is required"),
40-
});
41-
42-
/**
43-
* Schema for prompt icons for display in user interfaces
44-
*/
45-
const PromptIconSchema = z.object({
46-
src: z.string().url().describe("Icon URL"),
47-
mimeType: z.string().optional().describe("Icon MIME type"),
48-
sizes: z.array(z.string()).optional().describe("Icon sizes"),
49-
});
50-
51-
/**
52-
* Schema for content within a prompt message
53-
*/
54-
const PromptMessageContentSchema = z.object({
55-
type: z.enum(["text", "image", "audio", "resource"]).describe("Content type"),
56-
text: z.string().optional().describe("Text content"),
57-
data: z.string().optional().describe("Base64-encoded data for image/audio"),
58-
mimeType: z
59-
.string()
60-
.optional()
61-
.describe("MIME type for image/audio/resource"),
62-
resource: z
63-
.object({
64-
uri: z.string().describe("Resource URI"),
65-
mimeType: z.string().optional().describe("Resource MIME type"),
66-
text: z.string().optional().describe("Resource text content"),
67-
blob: z.string().optional().describe("Base64-encoded resource blob"),
68-
})
69-
.optional()
70-
.describe("Embedded resource"),
71-
});
72-
73-
/**
74-
* Schema for a message in a prompt
75-
*/
76-
const PromptMessageSchema = z.object({
77-
role: z.enum(["user", "assistant"]).describe("Message role"),
78-
content: PromptMessageContentSchema.describe("Message content"),
79-
});
80-
81-
/**
82-
* Full prompt entity schema extending base collection fields
83-
*/
84-
export const PromptSchema = BaseCollectionEntitySchema.extend({
85-
arguments: z
86-
.array(PromptArgumentSchema)
87-
.optional()
88-
.describe("Arguments that can be passed when getting this prompt"),
89-
icons: z
90-
.array(PromptIconSchema)
91-
.optional()
92-
.describe("Icons for display in user interfaces"),
93-
messages: z.array(PromptMessageSchema).describe("Prompt messages template"),
94-
});
95-
96-
// Create collection bindings
97-
const PROMPTS_COLLECTION_BINDING = createCollectionBindings(
98-
"prompt",
99-
PromptSchema,
100-
);
101-
10235
// Extract binding schemas
10336
const LIST_BINDING = PROMPTS_COLLECTION_BINDING.find(
10437
(b) => b.name === "COLLECTION_PROMPT_LIST",

0 commit comments

Comments
 (0)