Skip to content

Commit de0e092

Browse files
authored
Merge pull request #7 from phughesmcr/dev
Fix Deno Deploy issues
2 parents 1fae183 + d4704f7 commit de0e092

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

deno.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"type": "git",
2525
"url": "git+https://github.com/phughesmcr/deno-mcp-template.git"
2626
},
27-
"nodeModulesDir": "auto",
2827
"imports": {
2928
"$/": "./src/",
3029
"@cliffy/command": "jsr:@cliffy/command@^1.0.0-rc.8",

src/mcp/tools/poem.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
22
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
33
import { z } from "zod/v3";
44

5-
import type { ToolConfig, ToolModule } from "$/shared/types.ts";
6-
import { createCallToolErrorResponse, createCallToolTextResponse } from "$/shared/utils.ts";
5+
import type { ToolConfig, ToolModule } from "../../shared/types.ts";
6+
import { createCallToolErrorResponse, createCallToolTextResponse } from "../../shared/utils.ts";
77

88
const schema = z.object({
99
prompt: z.string().describe("The prompt to generate a poem for"),
@@ -49,17 +49,19 @@ const callback = (mcp: McpServer) => async (args: any): Promise<CallToolResult>
4949
temperature: 0.7,
5050
});
5151

52-
if (response.content.type !== "text") {
52+
const content = Array.isArray(response.content) ? response.content[0] : response.content;
53+
54+
if (!content || content.type !== "text") {
5355
return createCallToolErrorResponse({
5456
error: "No text response from sampling",
5557
prompt,
56-
responseType: response.content.type,
58+
responseType: content?.type ?? "unknown",
5759
operation: "poem-generation",
5860
});
5961
}
6062

6163
return createCallToolTextResponse({
62-
poem: response.content.text,
64+
poem: content.text,
6365
prompt,
6466
timestamp: new Date().toISOString(),
6567
});

src/shared/types.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ export type ResourceTemplatePlugin = [
5151
];
5252

5353
/** Tool parameters */
54-
export type ToolPlugin = Parameters<McpServer["registerTool"]>;
54+
export type ToolPlugin = [
55+
name: string,
56+
// deno-lint-ignore no-explicit-any
57+
config: ToolConfig<any, any>,
58+
// deno-lint-ignore no-explicit-any
59+
cb: ToolCallback<any>,
60+
];
5561

5662
/** Tool configuration */
5763
export type ToolConfig<

0 commit comments

Comments
 (0)