round_2_context
Fetches Round 2 context with other models' Round 1 plans to prepare for generating your Round 2 plan.
Instructions
Get the Round 2 prompt with all other models' Round 1 plans injected — call this before generating your Round 2 plan
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| modelName | No | Your model name (e.g., 'sonnet4.6') — used to exclude your own Round 1 plan from the injected context |
Implementation Reference
- src/tools/round2.ts:105-141 (handler)The main handler for the round_2_context tool. Reads all Round 1 plans, filters out the caller's own plan, and builds a Round 2 prompt with all other models' plans injected.
export async function getRound2Context( projectRoot: string, identity: CallerIdentity ): Promise<{ prompt: string; error?: string }> { const config = await readConfig(projectRoot); if (!config) { return { prompt: "", error: "Project not initialized. Run `polyplan-mcp init` first." }; } const round1Plans = await readPlansByRound(projectRoot, "round1"); if (round1Plans.length < 2) { return { prompt: "", error: `Round 2 requires at least 2 Round 1 plans. Currently have ${round1Plans.length}.`, }; } // Split into own plan and others const ownPlan = round1Plans.find( (p) => p.cliTool === identity.cliTool && p.modelName === identity.modelName ); const otherPlans = round1Plans.filter( (p) => !(p.cliTool === identity.cliTool && p.modelName === identity.modelName) ); const prompt = generateRound2Prompt( config.projectName, ownPlan?.content ?? null, otherPlans.map((p) => ({ identifier: `${p.cliTool}-${p.modelName}`, content: p.content, })) ); return { prompt }; } - src/server.ts:123-125 (schema)Input schema for round_2_context — accepts an optional modelName string parameter.
{ modelName: z.string().optional().describe("Your model name (e.g., 'sonnet4.6') — used to exclude your own Round 1 plan from the injected context"), }, - src/server.ts:119-133 (registration)Registration of the round_2_context tool on the MCP server with its name, description, input schema, and handler callback.
// ─── round_2_context ────────────────────────────────────────────── server.tool( "round_2_context", "Get the Round 2 prompt with all other models' Round 1 plans injected — call this before generating your Round 2 plan", { modelName: z.string().optional().describe("Your model name (e.g., 'sonnet4.6') — used to exclude your own Round 1 plan from the injected context"), }, async (params, extra) => { const identity = detectCaller(server.server.getClientVersion(), params.modelName); const result = await getRound2Context(projectRoot, identity); if (result.error) return { content: [{ type: "text", text: `❌ ${result.error}` }] }; return { content: [{ type: "text", text: result.prompt }] }; } ); - src/tools/round2.ts:23-52 (helper)Helper function that builds the Round 2 prompt string containing the project name, the caller's own Round 1 plan, and all other models' Round 1 plans with instructions for peer review.
export function generateRound2Prompt( projectName: string, ownPlanContent: string | null, otherPlans: Array<{ identifier: string; content: string }> ): string { const ownSection = ownPlanContent ? `YOUR ROUND 1 PLAN:\n${ownPlanContent}` : "YOUR ROUND 1 PLAN:\n(No Round 1 plan found for this model — you are joining fresh in Round 2)"; const othersSection = otherPlans .map((p) => `--- ${p.identifier} ---\n${p.content}`) .join("\n\n"); return `You are participating in a multi-model planning session using PolyPlan. PROJECT: ${projectName} ROUND: 2 of 3 — Peer Review Master Plan ${ownSection} OTHER MODELS' ROUND 1 PLANS: ${othersSection} Your task: 1. Review all other models' plans 2. Note where you agree, disagree, or where they raised points you missed 3. If another model answered a question you had, incorporate that answer 4. Create your revised master plan informed by all the above 5. Explicitly note: what you changed from Round 1 and why`; }