{"version":3,"sources":["../../../../src/server/mcp/tools/get-project-metadata.ts"],"sourcesContent":["import type { McpServer } from 'next/dist/compiled/@modelcontextprotocol/sdk/server/mcp'\nimport { mcpTelemetryTracker } from '../mcp-telemetry-tracker'\n\nexport function registerGetProjectMetadataTool(\n  server: McpServer,\n  projectPath: string,\n  getDevServerUrl: () => string | undefined\n) {\n  server.registerTool(\n    'get_project_metadata',\n    {\n      description:\n        'Returns the the metadata of this Next.js project, including project path, dev server URL, etc.',\n      inputSchema: {},\n    },\n    async (_request) => {\n      // Track telemetry\n      mcpTelemetryTracker.recordToolCall('mcp/get_project_metadata')\n\n      try {\n        if (!projectPath) {\n          return {\n            content: [\n              {\n                type: 'text',\n                text: JSON.stringify({\n                  error:\n                    'Unable to determine the absolute path of the Next.js project.',\n                }),\n              },\n            ],\n          }\n        }\n\n        const devServerUrl = getDevServerUrl()\n\n        return {\n          content: [\n            {\n              type: 'text',\n              text: JSON.stringify({\n                projectPath,\n                devServerUrl,\n              }),\n            },\n          ],\n        }\n      } catch (error) {\n        return {\n          content: [\n            {\n              type: 'text',\n              text: JSON.stringify({\n                error: error instanceof Error ? error.message : String(error),\n              }),\n            },\n          ],\n        }\n      }\n    }\n  )\n}\n"],"names":["registerGetProjectMetadataTool","server","projectPath","getDevServerUrl","registerTool","description","inputSchema","_request","mcpTelemetryTracker","recordToolCall","content","type","text","JSON","stringify","error","devServerUrl","Error","message","String"],"mappings":";;;;+BAGgBA;;;eAAAA;;;qCAFoB;AAE7B,SAASA,+BACdC,MAAiB,EACjBC,WAAmB,EACnBC,eAAyC;IAEzCF,OAAOG,YAAY,CACjB,wBACA;QACEC,aACE;QACFC,aAAa,CAAC;IAChB,GACA,OAAOC;QACL,kBAAkB;QAClBC,wCAAmB,CAACC,cAAc,CAAC;QAEnC,IAAI;YACF,IAAI,CAACP,aAAa;gBAChB,OAAO;oBACLQ,SAAS;wBACP;4BACEC,MAAM;4BACNC,MAAMC,KAAKC,SAAS,CAAC;gCACnBC,OACE;4BACJ;wBACF;qBACD;gBACH;YACF;YAEA,MAAMC,eAAeb;YAErB,OAAO;gBACLO,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAMC,KAAKC,SAAS,CAAC;4BACnBZ;4BACAc;wBACF;oBACF;iBACD;YACH;QACF,EAAE,OAAOD,OAAO;YACd,OAAO;gBACLL,SAAS;oBACP;wBACEC,MAAM;wBACNC,MAAMC,KAAKC,SAAS,CAAC;4BACnBC,OAAOA,iBAAiBE,QAAQF,MAAMG,OAAO,GAAGC,OAAOJ;wBACzD;oBACF;iBACD;YACH;QACF;IACF;AAEJ","ignoreList":[0]}