import { z } from 'zod'; import { makeCodecontextTool } from './factory.js'; export const GetSymbolInfoInput = z.object({ symbol_name: z.string().min(1), file_path: z.string().trim().optional(), framework_type: z.string().optional(), }); export type GetSymbolInfoInputT = z.infer; const DESCRIPTION = 'Returns detailed information about a named symbol: definition location, kind (function/class/method/etc.), and (when known) framework-specific context (React component, Vue store, Angular service, …). ' + 'Tree-sitter coverage: full for JS/Python/Java/Go/Rust/C++. TypeScript symbols are approximate (uses JS grammar). ' + 'PHP and SQL are not supported — fall back to grep for those.'; const { toolDef: getSymbolInfo, execute: executeGetSymbolInfo } = makeCodecontextTool({ name: 'get_symbol_info', schema: GetSymbolInfoInput, description: DESCRIPTION, jsonParameters: { type: 'object', properties: { symbol_name: { type: 'string', description: 'The symbol name to look up (case-sensitive).', }, file_path: { type: 'string', description: 'Narrow to a specific file when the symbol name is ambiguous.', }, framework_type: { type: 'string', description: 'Hint for framework-specific extraction (react|vue|svelte|django|fastapi|express|nest|…).', }, }, required: ['symbol_name'], additionalProperties: false, }, mapArgs: (input) => { const args: Record = { symbol_name: input.symbol_name }; if (input.file_path) args['file_path'] = input.file_path; if (input.framework_type) args['framework_type'] = input.framework_type; return args; }, }); export { getSymbolInfo, executeGetSymbolInfo };