import { z } from 'zod'; import { makeCodecontextTool } from './factory.js'; export const GetRoutesInput = z.object({ framework: z.string().trim().optional(), }); export type GetRoutesInputT = z.infer; const DESCRIPTION = 'Extracts HTTP routes from the project via tree-sitter AST analysis. ' + 'Detects Fastify and Express route registrations (app.get, app.post, app.route, router.use, etc.) ' + 'with method, path, file, line number, and inferred tags (db, auth, cache). ' + 'Optional framework filter narrows to "fastify" or "express".'; const { toolDef: getRoutes, execute: executeGetRoutes } = makeCodecontextTool({ name: 'get_routes', schema: GetRoutesInput, description: DESCRIPTION, jsonParameters: { type: 'object', properties: { framework: { type: 'string', description: 'Filter to a specific framework: "fastify" or "express". Omit for all.', }, }, additionalProperties: false, }, mapArgs: (input) => { const args: Record = {}; if (input.framework) args.framework = input.framework; return args; }, }); export { getRoutes, executeGetRoutes };