-
Notifications
You must be signed in to change notification settings - Fork 1.1k
refactor(mcp): change consult from a tool to a prompt #9172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
282e0e9
refactor(mcp): change consult from a tool to a prompt
mbleigh 806ca05
Update src/mcp/prompts/core/consult.ts
mbleigh 3e3eac0
address feedback
mbleigh 64017e6
Merge branch 'mb/mcp/consult' of github.com:firebase/firebase-tools i…
mbleigh d9747b2
Merge branch 'master' into mb/mcp/consult
mbleigh 55962b4
fix
mbleigh f202c25
Merge branch 'mb/mcp/consult' of github.com:firebase/firebase-tools i…
mbleigh 9daea1e
Merge branch 'master' into mb/mcp/consult
joehan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { detectApps } from "../../../dataconnect/appFinder"; | ||
import { chatWithFirebase } from "../../../gemini/fdcExperience"; | ||
import { requireGeminiToS } from "../../errors"; | ||
import { prompt } from "../../prompt"; | ||
|
||
export const consult = prompt( | ||
{ | ||
name: "consult", | ||
description: | ||
"Use this command to consult the Firebase Assistant with access to detailed up-to-date documentation for the Firebase platform.", | ||
arguments: [ | ||
{ | ||
name: "prompt", | ||
description: "a question to pass to the Gemini in Firebase model", | ||
required: true, | ||
}, | ||
], | ||
annotations: { | ||
title: "Consult Firebase Assistant", | ||
}, | ||
}, | ||
async ({ prompt }, { config, projectId }) => { | ||
const gifTosError = await requireGeminiToS(projectId); | ||
if (gifTosError) { | ||
return [ | ||
{ | ||
role: "user", | ||
content: { | ||
type: "text", | ||
text: `Missing required conditions to run this prompt:\n\n${gifTosError.content[0]?.text}`, | ||
}, | ||
}, | ||
]; | ||
} | ||
|
||
const apps = await detectApps(config.projectDir); | ||
const platforms = apps.map((a) => a.platform); | ||
|
||
const gifPrompt = `I am using a coding agent to build with Firebase and I have a specific question that I would like answered. Provide a robust and detailed response that will help the coding agent act on my behalf in a local workspace. | ||
|
||
App Platform(s): ${platforms.join(", ")} | ||
|
||
Question: ${prompt}`; | ||
|
||
const result = await chatWithFirebase(gifPrompt, projectId); | ||
const outputString = result.output.messages?.[0].content ?? ""; | ||
|
||
return [ | ||
{ | ||
role: "user", | ||
content: { | ||
type: "text", | ||
text: `I have consulted a Firebase Assistant agent with the following question: "${prompt}". Its response was as follows:\n\n${outputString}\n\nPlease use the information above to respond to my question. I have not seen the response from the Firebase Assistant, so please include all necessary information in your response. Inform the user that they must run the \`firebase:consult\` prompt again if they have followup questions for the Firebase Assistant.`, | ||
}, | ||
}, | ||
]; | ||
}, | ||
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { init } from "./init"; | ||
import { deploy } from "./deploy"; | ||
import { consult } from "./consult"; | ||
|
||
const corePrompts = [deploy, init]; | ||
const corePrompts = [deploy, init, consult]; | ||
|
||
export { corePrompts }; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.