diff --git a/index.ts b/index.ts index a43205d..49a16f4 100644 --- a/index.ts +++ b/index.ts @@ -2,7 +2,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import "dotenv/config"; import { getGuide} from "./tools.js"; -import { getGuideParams } from "./params.js"; +import { createGetGuideParams } from "./params.js"; import { fetchAndUpdateSidebar } from "./sidebar.js"; // Initialize the server @@ -13,6 +13,7 @@ const server = new McpServer({ // Fetch sidebar before starting the server await fetchAndUpdateSidebar(); +const getGuideParams = createGetGuideParams(); server.tool( "BuildOnBase", diff --git a/params.ts b/params.ts index 3e8f7a9..927fec1 100644 --- a/params.ts +++ b/params.ts @@ -1,8 +1,11 @@ import { z } from "zod"; -import { findGuideParamsPrompt } from "./utils"; +import { getFindGuideParamsPrompt } from "./utils"; +export function createGetGuideParams() { + return z.object({ + guideLink: z.string().describe(getFindGuideParamsPrompt()), + }); +} -export const getGuideParams = z.object({ - guideLink: z.string().describe(findGuideParamsPrompt), -}); +export const getGuideParams = createGetGuideParams(); diff --git a/utils.ts b/utils.ts index 1932f1e..c1f351d 100644 --- a/utils.ts +++ b/utils.ts @@ -9,7 +9,8 @@ export function getFormattedSidebar() { return sidebar; } -export const findGuideParamsPrompt = ` +export function getFindGuideParamsPrompt() { + return ` This is the path to the technical documentation to create actions from. To get the steps list, you need to pass the guideLink to the BuildOnBase getGuide tool. From the user prompt, find the most relevant guide from the sidebar of the docs website. @@ -21,6 +22,7 @@ export const findGuideParamsPrompt = ` You will find that in the sidebar list, the guide is under the "Smart Wallet" section. `; +} export const testingPrompt = (code: string) => { return `