Skip to content

Commit 16cbf74

Browse files
committed
fix: remove stale limit/offset from MCP impact_analysis and constrain EngineOpts typing (#558)
- Remove limit/offset from impact-analysis MCP handler and tool schema since impactAnalysisData never supported pagination - Rename local EngineOpts to ParseEngineOpts and constrain engine field to EngineMode union type instead of unchecked string Impact: 1 functions changed, 0 affected
1 parent 00b2fd7 commit 16cbf74

4 files changed

Lines changed: 8 additions & 14 deletions

File tree

src/domain/parser.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { Tree } from 'web-tree-sitter';
55
import { Language, Parser, Query } from 'web-tree-sitter';
66
import { debug, warn } from '../infrastructure/logger.js';
77
import { getNative, getNativePackageVersion, loadNative } from '../infrastructure/native.js';
8-
import type { LanguageRegistryEntry } from '../types.js';
8+
import type { EngineMode, LanguageRegistryEntry } from '../types.js';
99

1010
// Re-export all extractors for backward compatibility
1111
export {
@@ -55,8 +55,8 @@ const TS_BACKFILL_EXTS = new Set(['.ts', '.tsx']);
5555
// Re-export for backward compatibility
5656
export type { LanguageRegistryEntry } from '../types.js';
5757

58-
interface EngineOpts {
59-
engine?: string;
58+
interface ParseEngineOpts {
59+
engine?: EngineMode;
6060
dataflow?: boolean;
6161
ast?: boolean;
6262
}
@@ -249,7 +249,7 @@ export function isWasmAvailable(): boolean {
249249

250250
// ── Unified API ──────────────────────────────────────────────────────────────
251251

252-
function resolveEngine(opts: EngineOpts = {}): ResolvedEngine {
252+
function resolveEngine(opts: ParseEngineOpts = {}): ResolvedEngine {
253253
const pref = opts.engine || 'auto';
254254
if (pref === 'wasm') return { name: 'wasm', native: null };
255255
if (pref === 'native' || pref === 'auto') {
@@ -489,7 +489,7 @@ function wasmExtractSymbols(
489489
export async function parseFileAuto(
490490
filePath: string,
491491
source: string,
492-
opts: EngineOpts = {},
492+
opts: ParseEngineOpts = {},
493493
): Promise<any> {
494494
const { native } = resolveEngine(opts);
495495

@@ -523,7 +523,7 @@ export async function parseFileAuto(
523523
export async function parseFilesAuto(
524524
filePaths: string[],
525525
rootDir: string,
526-
opts: EngineOpts = {},
526+
opts: ParseEngineOpts = {},
527527
): Promise<Map<string, any>> {
528528
const { native } = resolveEngine(opts);
529529
// biome-ignore lint/suspicious/noExplicitAny: result values have dynamic shape from extractors
@@ -615,7 +615,7 @@ export async function parseFilesAuto(
615615
/**
616616
* Report which engine is active.
617617
*/
618-
export function getActiveEngine(opts: EngineOpts = {}): {
618+
export function getActiveEngine(opts: ParseEngineOpts = {}): {
619619
name: 'native' | 'wasm';
620620
version: string | null;
621621
} {
@@ -656,7 +656,7 @@ export async function parseFileIncremental(
656656
cache: any,
657657
filePath: string,
658658
source: string,
659-
opts: EngineOpts = {},
659+
opts: ParseEngineOpts = {},
660660
): Promise<any> {
661661
if (cache) {
662662
const result = cache.parseFile(filePath, source);

src/mcp/tool-registry.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ const BASE_TOOLS = [
139139
properties: {
140140
file: { type: 'string', description: 'File path to analyze' },
141141
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
142-
...PAGINATION_PROPS,
143142
},
144143
required: ['file'],
145144
},

src/mcp/tool-registry.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ const BASE_TOOLS: ToolSchema[] = [
149149
properties: {
150150
file: { type: 'string', description: 'File path to analyze' },
151151
no_tests: { type: 'boolean', description: 'Exclude test files', default: false },
152-
...PAGINATION_PROPS,
153152
},
154153
required: ['file'],
155154
},

src/mcp/tools/impact-analysis.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
import { effectiveLimit, effectiveOffset } from '../middleware.js';
2-
31
export const name = 'impact_analysis';
42

53
export async function handler(args, ctx) {
64
const { impactAnalysisData } = await ctx.getQueries();
75
return impactAnalysisData(args.file, ctx.dbPath, {
86
noTests: args.no_tests,
9-
limit: effectiveLimit(args, name),
10-
offset: effectiveOffset(args),
117
});
128
}

0 commit comments

Comments
 (0)