feat(server): add boocontext deep analysis tools and synthesis pipeline
- get_symbol_details: type signature, definition location, usage count - get_call_graph: callers, callees, transitive references - get_blast_radius added to SYNTHESIS_TOOLS
This commit is contained in:
@@ -35,6 +35,7 @@ export const SYNTHESIS_TOOLS: ReadonlySet<string> = new Set([
|
||||
'get_codebase_overview',
|
||||
'get_framework_analysis',
|
||||
'get_semantic_neighborhoods',
|
||||
'get_blast_radius',
|
||||
]);
|
||||
|
||||
const TOP_N_FILES = 5;
|
||||
|
||||
31
apps/server/src/services/tools/codecontext/get_call_graph.ts
Normal file
31
apps/server/src/services/tools/codecontext/get_call_graph.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { z } from 'zod';
|
||||
import { makeCodecontextTool } from './factory.js';
|
||||
|
||||
export const GetCallGraphInput = z.object({
|
||||
symbol: z.string().describe('Symbol name to analyze'),
|
||||
depth: z.number().int().min(1).max(5).optional().describe('Max traversal depth (default 2)'),
|
||||
});
|
||||
export type GetCallGraphInputT = z.infer<typeof GetCallGraphInput>;
|
||||
|
||||
const DESCRIPTION =
|
||||
'Returns a call graph for a function or method: callers, callees, and transitive references. ' +
|
||||
'Use to understand how a symbol is invoked and what it depends on.';
|
||||
|
||||
const { toolDef: getCallGraph, execute: executeGetCallGraph } =
|
||||
makeCodecontextTool<GetCallGraphInputT>({
|
||||
name: 'get_call_graph',
|
||||
schema: GetCallGraphInput,
|
||||
description: DESCRIPTION,
|
||||
jsonParameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
symbol: { type: 'string', description: 'Symbol name to analyze' },
|
||||
depth: { type: 'number', description: 'Max traversal depth (default 2)' },
|
||||
},
|
||||
required: ['symbol'],
|
||||
additionalProperties: false,
|
||||
},
|
||||
mapArgs: (input) => ({ symbol: input.symbol, depth: input.depth ?? 2 }),
|
||||
});
|
||||
|
||||
export { getCallGraph, executeGetCallGraph };
|
||||
@@ -0,0 +1,31 @@
|
||||
import { z } from 'zod';
|
||||
import { makeCodecontextTool } from './factory.js';
|
||||
|
||||
export const GetSymbolDetailsInput = z.object({
|
||||
symbol: z.string().describe('Symbol name to resolve'),
|
||||
file_path: z.string().optional().describe('Optional file path to narrow search'),
|
||||
});
|
||||
export type GetSymbolDetailsInputT = z.infer<typeof GetSymbolDetailsInput>;
|
||||
|
||||
const DESCRIPTION =
|
||||
'Returns type signature, definition location, and usage count for a named symbol. ' +
|
||||
'Use after get_codebase_overview to dive deeper into specific functions, classes, or variables.';
|
||||
|
||||
const { toolDef: getSymbolDetails, execute: executeGetSymbolDetails } =
|
||||
makeCodecontextTool<GetSymbolDetailsInputT>({
|
||||
name: 'get_symbol_details',
|
||||
schema: GetSymbolDetailsInput,
|
||||
description: DESCRIPTION,
|
||||
jsonParameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
symbol: { type: 'string', description: 'Symbol name to resolve' },
|
||||
file_path: { type: 'string', description: 'Optional file path to narrow search' },
|
||||
},
|
||||
required: ['symbol'],
|
||||
additionalProperties: false,
|
||||
},
|
||||
mapArgs: (input) => ({ symbol: input.symbol, file_path: input.file_path }),
|
||||
});
|
||||
|
||||
export { getSymbolDetails, executeGetSymbolDetails };
|
||||
Reference in New Issue
Block a user