Skip to content

Commit 2214083

Browse files
authored
fix(mcp): prompt arguments were not working correctly (#8976)
1 parent e91e10d commit 2214083

File tree

3 files changed

+14
-24
lines changed

3 files changed

+14
-24
lines changed

src/mcp/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ export class FirebaseMcpServer {
362362
name: p.mcp.name,
363363
description: p.mcp.description,
364364
annotations: p.mcp.annotations,
365-
inputSchema: p.mcp.inputSchema,
365+
arguments: p.mcp.arguments,
366366
})),
367367
_meta: {
368368
projectRoot: this.cachedProjectRoot,
@@ -377,7 +377,7 @@ export class FirebaseMcpServer {
377377
async mcpGetPrompt(req: GetPromptRequest): Promise<GetPromptResult> {
378378
await this.detectProjectRoot();
379379
const promptName = req.params.name;
380-
const promptArgs = req.params.arguments;
380+
const promptArgs = req.params.arguments || {};
381381
const prompt = this.getPrompt(promptName);
382382
if (!prompt) {
383383
throw new Error(`Prompt '${promptName}' could not be found.`);

src/mcp/prompt.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { PromptMessage } from "@modelcontextprotocol/sdk/types.js";
2-
import { z, ZodTypeAny } from "zod";
3-
import { zodToJsonSchema } from "zod-to-json-schema";
42
import type { FirebaseMcpServer } from "./index";
53
import type { Config } from "../config";
64
import { RC } from "../rc";
7-
import { cleanSchema } from "./util";
85

96
export interface ServerPromptContext {
107
projectId: string;
@@ -14,11 +11,11 @@ export interface ServerPromptContext {
1411
rc: RC;
1512
}
1613

17-
export interface ServerPrompt<InputSchema extends ZodTypeAny = ZodTypeAny> {
14+
export interface ServerPrompt {
1815
mcp: {
1916
name: string;
2017
description?: string;
21-
inputSchema: any;
18+
arguments?: { name: string; description?: string; required?: boolean }[];
2219
omitPrefix?: boolean;
2320
annotations?: {
2421
title?: string;
@@ -28,19 +25,12 @@ export interface ServerPrompt<InputSchema extends ZodTypeAny = ZodTypeAny> {
2825
feature?: string;
2926
};
3027
};
31-
fn: (input: z.infer<InputSchema>, ctx: ServerPromptContext) => Promise<PromptMessage[]>;
28+
fn: (args: Record<string, string>, ctx: ServerPromptContext) => Promise<PromptMessage[]>;
3229
}
3330

34-
export function prompt<InputSchema extends ZodTypeAny>(
35-
options: Omit<ServerPrompt<InputSchema>["mcp"], "inputSchema" | "name"> & {
36-
name: string;
37-
inputSchema: InputSchema;
38-
omitPrefix?: boolean;
39-
},
40-
fn: ServerPrompt<InputSchema>["fn"],
41-
): ServerPrompt {
31+
export function prompt(options: ServerPrompt["mcp"], fn: ServerPrompt["fn"]): ServerPrompt {
4232
return {
43-
mcp: { ...options, inputSchema: cleanSchema(zodToJsonSchema(options.inputSchema)) },
33+
mcp: options,
4434
fn,
4535
};
4636
}

src/mcp/prompts/core/deploy.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import { z } from "zod";
21
import { prompt } from "../../prompt";
32

43
export const deploy = prompt(
54
{
65
name: "deploy",
76
omitPrefix: true,
87
description: "Use this command to deploy resources to Firebase.",
9-
inputSchema: z.object({
10-
prompt: z
11-
.string()
12-
.describe("any specific instructions you wish to provide about deploying")
13-
.optional(),
14-
}),
8+
arguments: [
9+
{
10+
name: "prompt",
11+
description: "any specific instructions you wish to provide about deploying",
12+
required: false,
13+
},
14+
],
1515
annotations: {
1616
title: "Deploy to Firebase",
1717
},

0 commit comments

Comments
 (0)