Skip to content

Commit b077b0f

Browse files
committed
mcp: delete the last hand-written tool shapes from the remote server (#9662)
`grep -cE "^const \w+Shape = \{" src/mcp/server.ts` returns **0**. Four of them were still a registration's `inputSchema` -- `issueRagShape`, `findOpportunitiesShape`, `localBranchVariantsShape`, `variantsShape` -- agreeing with their contract entries only by history, with nothing to keep them agreeing. The other fifteen had stopped being registered but survived as the TYPE of their handler (`z.infer<z.ZodObject<typeof preflightShape>>`), which is the same defect one step removed: a handler typed off a hand-written shape can drift from the contract the tool actually registers with, and the compiler is satisfied either way. Both variant tools took the narrower element type: `ComparePrVariantsInput.variants` was an array of the STDIO server's `LocalScoreInput` while the remote's own handler expected the wider one, so the remote accepted variants its registry entry rejected. The element is the union now, with `StdioComparePrVariantsInput` / `StdioCompareLocalVariantsInput` as the declared narrowings -- the same treatment their singular siblings got. Gone with them: `changedFileSchema`, `validationEntrySchema` and `planRepoIssuesMilestoneShape`, which existed only to build the shapes above; the contract already declares all three.
1 parent 8fbd5c3 commit b077b0f

3 files changed

Lines changed: 43 additions & 301 deletions

File tree

packages/loopover-contract/src/tools/local-branch.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ export const draftPrBodyTool = defineTool({
253253
});
254254

255255
export const CompareLocalVariantsInput = z.object({
256+
variants: z.array(LocalBranchAnalysisInput).min(1).max(10),
257+
});
258+
/** What the STDIO server serves: each variant is analysed from the checkout, not from caller-supplied shas. */
259+
export const StdioCompareLocalVariantsInput = z.object({
256260
variants: z.array(CurrentBranchInput).min(1).max(10),
257261
});
258262
export const compareLocalVariantsTool = defineTool({
@@ -381,6 +385,12 @@ export const getEligibilityPlanTool = defineTool({
381385
});
382386

383387
export const ComparePrVariantsInput = z.object({
388+
// #9662: the same union each variant's SINGULAR tool takes, for the same reason -- the element type was
389+
// the stdio server's narrower one, so the remote's own handler accepted variants the registry rejected.
390+
variants: z.array(LocalScorePreviewInput).min(1).max(10),
391+
});
392+
/** What the STDIO server serves: each variant goes through its local preview, which supplies the rest. */
393+
export const StdioComparePrVariantsInput = z.object({
384394
variants: z.array(LocalScoreInput).min(1).max(10),
385395
});
386396
export const comparePrVariantsTool = defineTool({

packages/loopover-mcp/bin/loopover-mcp.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ import {
9090
CheckTestEvidenceInput,
9191
ClearSelftuneOverrideInput,
9292
ClosePrInput,
93-
CompareLocalVariantsInput,
94-
ComparePrVariantsInput,
9593
CreateBranchInput,
9694
CurrentBranchInput,
9795
DecidePendingActionInput,
@@ -166,6 +164,8 @@ import {
166164
ValidateLinkedIssueInput,
167165
WatchIssuesInput,
168166
StdioWatchIssuesInput,
167+
StdioCompareLocalVariantsInput,
168+
StdioComparePrVariantsInput,
169169
getToolContract,
170170
projectToolDefinition,
171171
ListPendingActionsStdioInput,
@@ -1620,13 +1620,14 @@ registerStdioTool(
16201620

16211621
registerStdioTool(
16221622
"loopover_compare_pr_variants",
1623-
async ({ variants }: z.infer<typeof ComparePrVariantsInput>) => {
1623+
async ({ variants }: z.infer<typeof StdioComparePrVariantsInput>) => {
16241624
const roots = await clientWorkspaceRoots();
16251625
const previews = [];
16261626
for (const variant of variants) previews.push(await previewLocalScore(withWorkspaceRoots({ ...variant, targetKey: variant.targetKey ?? `variant:${previews.length + 1}` }, roots)));
16271627
previews.sort((left, right) => Number(right?.remotePreview?.result?.effectiveEstimatedScore ?? right?.remotePreview?.result?.scoreEstimate?.estimatedMergedScore ?? 0) - Number(left?.remotePreview?.result?.effectiveEstimatedScore ?? left?.remotePreview?.result?.scoreEstimate?.estimatedMergedScore ?? 0));
16281628
return toolResult("LoopOver PR variant comparison.", { variants: previews });
16291629
},
1630+
{ input: StdioComparePrVariantsInput },
16301631
);
16311632

16321633
registerStdioTool(
@@ -1757,7 +1758,7 @@ registerStdioTool(
17571758

17581759
registerStdioTool(
17591760
"loopover_compare_local_variants",
1760-
async ({ variants }: z.infer<typeof CompareLocalVariantsInput>) => {
1761+
async ({ variants }: z.infer<typeof StdioCompareLocalVariantsInput>) => {
17611762
const roots = await clientWorkspaceRoots();
17621763
const analyses = [];
17631764
for (const variant of variants) analyses.push(await analyzeCurrentBranch(withWorkspaceRoots(variant, roots)));
@@ -1776,6 +1777,7 @@ registerStdioTool(
17761777
})),
17771778
});
17781779
},
1780+
{ input: StdioCompareLocalVariantsInput },
17791781
);
17801782

17811783
registerStdioTool(

0 commit comments

Comments
 (0)