@pantheon.ai/mcp 0.1.2 → 0.1.3
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/cli.js +23 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -858,7 +858,7 @@ function getServerErrorMessage(error) {
|
|
|
858
858
|
|
|
859
859
|
//#endregion
|
|
860
860
|
//#region package.json
|
|
861
|
-
var version = "0.1.
|
|
861
|
+
var version = "0.1.2";
|
|
862
862
|
|
|
863
863
|
//#endregion
|
|
864
864
|
//#region src/mcp/mcp.ts
|
|
@@ -879,12 +879,19 @@ async function mcpServer({ authorizationHeader }) {
|
|
|
879
879
|
version,
|
|
880
880
|
websiteUrl: "https://pantheon-ai.tidb.ai/"
|
|
881
881
|
}, { instructions: "Pantheon concepts: a project maps to a forest; snaps are execution snapshots linked by SourceSnapID; a branch is a lineage of snaps; an exploration is a named, prompt-driven sequence of snaps that ends with an artifacts analysis snap. Use tools to list projects/branches/explorations, execute prompts on branches, and read branch files." });
|
|
882
|
-
function registerApiTool(name, api, { paramsSchema, bodySchema, ...options }, toolCallback) {
|
|
882
|
+
function registerApiTool(name, api, { paramsSchema, bodySchema, outputSchema, ...options }, toolCallback) {
|
|
883
883
|
const inputSchemaShape = {};
|
|
884
884
|
if (paramsSchema) inputSchemaShape.params = paramsSchema;
|
|
885
885
|
if (bodySchema) inputSchemaShape.body = bodySchema;
|
|
886
886
|
mcpServer.registerTool(`pantheon.${name}`, {
|
|
887
887
|
...options,
|
|
888
|
+
outputSchema: outputSchema ? z.union([z.object({
|
|
889
|
+
success: z.literal(true),
|
|
890
|
+
result: outputSchema
|
|
891
|
+
}), z.object({
|
|
892
|
+
success: z.literal(false),
|
|
893
|
+
error: z.string()
|
|
894
|
+
})]) : void 0,
|
|
888
895
|
inputSchema: z.object(inputSchemaShape)
|
|
889
896
|
}, toolCallback ?? (async ({ params, body }) => {
|
|
890
897
|
try {
|
|
@@ -894,13 +901,22 @@ async function mcpServer({ authorizationHeader }) {
|
|
|
894
901
|
type: "text",
|
|
895
902
|
text: JSON.stringify(result)
|
|
896
903
|
}],
|
|
897
|
-
structuredContent:
|
|
904
|
+
structuredContent: {
|
|
905
|
+
success: true,
|
|
906
|
+
result
|
|
907
|
+
}
|
|
898
908
|
};
|
|
899
909
|
} catch (e) {
|
|
900
|
-
return {
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
910
|
+
return {
|
|
911
|
+
content: [{
|
|
912
|
+
type: "text",
|
|
913
|
+
text: getErrorMessage(e)
|
|
914
|
+
}],
|
|
915
|
+
structuredContent: {
|
|
916
|
+
success: false,
|
|
917
|
+
error: getErrorMessage(e)
|
|
918
|
+
}
|
|
919
|
+
};
|
|
904
920
|
}
|
|
905
921
|
}));
|
|
906
922
|
}
|