@malloydata/malloyyo 0.2.46 → 0.2.47
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 +37 -37
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -250,7 +250,7 @@ var prompts = {
|
|
|
250
250
|
"title": "Inspect a published source"
|
|
251
251
|
},
|
|
252
252
|
"list_sources": {
|
|
253
|
-
"description": "List the sources you can query, grouped by the model that publishes them, with each model's named queries. Drill into a source with describe_source before writing a query.",
|
|
253
|
+
"description": "List the sources you can query, grouped by the model that publishes them, with each model's named queries. Drill into a source with describe_source before writing a query. A model may also report `dashboards` \u2014 pre-built pages for that model, each with a `url` a person can open; offer one when it already covers the question, and query the sources otherwise.",
|
|
254
254
|
"title": "List sources"
|
|
255
255
|
}
|
|
256
256
|
}
|
|
@@ -1812,6 +1812,17 @@ function listSourcesTool(host) {
|
|
|
1812
1812
|
}
|
|
1813
1813
|
m.sources = sources;
|
|
1814
1814
|
}
|
|
1815
|
+
if (e.dashboards?.length) {
|
|
1816
|
+
const dashboards = /* @__PURE__ */ Object.create(null);
|
|
1817
|
+
for (const d of e.dashboards) {
|
|
1818
|
+
const o = {};
|
|
1819
|
+
if (d.title) o.title = d.title;
|
|
1820
|
+
if (d.description) o.description = d.description;
|
|
1821
|
+
if (d.url) o.url = d.url;
|
|
1822
|
+
dashboards[d.name] = o;
|
|
1823
|
+
}
|
|
1824
|
+
m.dashboards = dashboards;
|
|
1825
|
+
}
|
|
1815
1826
|
models[e.model_ref] = m;
|
|
1816
1827
|
}
|
|
1817
1828
|
return { ok: true, guidance: prompts.explore.guidance, models };
|
|
@@ -2890,7 +2901,7 @@ function clearCreds(url6) {
|
|
|
2890
2901
|
}
|
|
2891
2902
|
|
|
2892
2903
|
// package.json
|
|
2893
|
-
var version = "0.2.
|
|
2904
|
+
var version = "0.2.47";
|
|
2894
2905
|
|
|
2895
2906
|
// src/http.ts
|
|
2896
2907
|
var USER_AGENT = `malloyyo/${version}`;
|
|
@@ -3146,8 +3157,8 @@ Run: malloyyo login ${target.name}`);
|
|
|
3146
3157
|
import fs4 from "node:fs";
|
|
3147
3158
|
import path5 from "node:path";
|
|
3148
3159
|
import url4 from "node:url";
|
|
3149
|
-
import { McpServer } from "@modelcontextprotocol/
|
|
3150
|
-
import { StdioServerTransport } from "@modelcontextprotocol/
|
|
3160
|
+
import { McpServer } from "@modelcontextprotocol/server";
|
|
3161
|
+
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
|
|
3151
3162
|
import {
|
|
3152
3163
|
MalloyConfig as MalloyConfig2,
|
|
3153
3164
|
Runtime as Runtime2,
|
|
@@ -3156,9 +3167,8 @@ import {
|
|
|
3156
3167
|
|
|
3157
3168
|
// ../mcp-engine/dist/mcp-sdk.js
|
|
3158
3169
|
import {
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
} from "@modelcontextprotocol/sdk/types.js";
|
|
3170
|
+
fromJsonSchema
|
|
3171
|
+
} from "@modelcontextprotocol/server";
|
|
3162
3172
|
var HOST_ONLY2 = "host_only";
|
|
3163
3173
|
function toContent(result) {
|
|
3164
3174
|
const { malloy_text, [HOST_ONLY2]: _hostOnly, ...rest } = result;
|
|
@@ -3170,37 +3180,28 @@ function toContent(result) {
|
|
|
3170
3180
|
}
|
|
3171
3181
|
return { content, structuredContent: { ...rest } };
|
|
3172
3182
|
}
|
|
3173
|
-
|
|
3174
|
-
|
|
3183
|
+
var PASS_THROUGH = {
|
|
3184
|
+
getValidator: () => (input) => ({ valid: true, data: input, errorMessage: void 0 })
|
|
3185
|
+
};
|
|
3186
|
+
function publishedSchema(schema) {
|
|
3187
|
+
return fromJsonSchema(schema, PASS_THROUGH);
|
|
3175
3188
|
}
|
|
3176
3189
|
function attachSurface(server, surface, opts = {}) {
|
|
3177
|
-
const
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
s.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
3188
|
-
const tool = byName.get(req.params.name);
|
|
3189
|
-
if (!tool) {
|
|
3190
|
-
return {
|
|
3191
|
-
content: [{ type: "text", text: `unknown tool: ${req.params.name}` }],
|
|
3192
|
-
isError: true
|
|
3193
|
-
};
|
|
3194
|
-
}
|
|
3195
|
-
const result = await tool.handler(
|
|
3196
|
-
req.params.arguments ?? {}
|
|
3190
|
+
for (const tool of surface.tools) {
|
|
3191
|
+
server.registerTool(
|
|
3192
|
+
tool.name,
|
|
3193
|
+
{
|
|
3194
|
+
title: tool.title,
|
|
3195
|
+
description: tool.description,
|
|
3196
|
+
inputSchema: publishedSchema(tool.inputSchema)
|
|
3197
|
+
},
|
|
3198
|
+
// Compile/run failures are data (problems[]), never protocol errors.
|
|
3199
|
+
async (args) => toContent(await tool.handler(args ?? {}))
|
|
3197
3200
|
);
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
if (opts.registerSkillsAsPrompts && "registerPrompt" in server) {
|
|
3201
|
-
const mcp = server;
|
|
3201
|
+
}
|
|
3202
|
+
if (opts.registerSkillsAsPrompts) {
|
|
3202
3203
|
for (const skill of surface.skills) {
|
|
3203
|
-
|
|
3204
|
+
server.registerPrompt(
|
|
3204
3205
|
skill.name,
|
|
3205
3206
|
{ title: skill.name, description: skill.description },
|
|
3206
3207
|
() => ({
|
|
@@ -3209,7 +3210,7 @@ function attachSurface(server, surface, opts = {}) {
|
|
|
3209
3210
|
]
|
|
3210
3211
|
})
|
|
3211
3212
|
);
|
|
3212
|
-
|
|
3213
|
+
server.registerResource(
|
|
3213
3214
|
skill.name,
|
|
3214
3215
|
`malloy-skill://${skill.name}`,
|
|
3215
3216
|
{ title: skill.name, description: skill.description, mimeType: "text/markdown" },
|
|
@@ -3334,8 +3335,7 @@ async function serveMcp(opts) {
|
|
|
3334
3335
|
const server = new McpServer(
|
|
3335
3336
|
{ name: serverName, version: opts.version },
|
|
3336
3337
|
{
|
|
3337
|
-
instructions: renderInstructions(surface.instructions, instanceName) + MODE_STUB[mode]
|
|
3338
|
-
capabilities: { tools: {}, prompts: {}, resources: {} }
|
|
3338
|
+
instructions: renderInstructions(surface.instructions, instanceName) + MODE_STUB[mode]
|
|
3339
3339
|
}
|
|
3340
3340
|
);
|
|
3341
3341
|
attachSurface(server, surface, { registerSkillsAsPrompts: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/malloyyo",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.47",
|
|
4
4
|
"description": "Publish Malloy models to a Malloyyo instance",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@malloydata/malloy-connections": "^0.0.431",
|
|
40
40
|
"@malloydata/malloy-filter": "^0.0.431",
|
|
41
41
|
"@malloydata/render": "^0.0.431",
|
|
42
|
-
"@modelcontextprotocol/
|
|
42
|
+
"@modelcontextprotocol/server": "^2.0.0",
|
|
43
43
|
"commander": "^12.1.0",
|
|
44
44
|
"esbuild": "^0.24.0",
|
|
45
45
|
"react": "19.2.4",
|