ts-project-indexer-mcp
Version:
A powerful MCP (Model Context Protocol) server that indexes and analyzes TypeScript/JavaScript projects, providing intelligent code exploration, dependency tracking, method discovery, and project structure analysis for AI assistants and development tools.
45 lines • 1.63 kB
JavaScript
export async function findDependenciesTool(indexer, args) {
const { entityName, direction = 'both', depth = 2 } = args;
if (!entityName) {
return {
content: [
{
type: 'text',
text: JSON.stringify({
success: false,
error: 'entityName parameter is required',
message: 'Missing required parameter',
}, null, 2),
},
],
};
}
const result = await indexer.findDependencies(entityName, direction, depth);
const graphObj = {};
for (const [key, value] of result.graph) {
graphObj[key] = value;
}
return {
content: [
{
type: 'text',
text: JSON.stringify({
success: true,
result: {
entity: result.entity,
incoming: result.incoming,
outgoing: result.outgoing,
graph: graphObj,
summary: {
incomingCount: result.incoming.length,
outgoingCount: result.outgoing.length,
totalNodes: result.graph.size,
},
},
message: `Found ${result.incoming.length} incoming and ${result.outgoing.length} outgoing dependencies for "${entityName}"`,
}, null, 2),
},
],
};
}
//# sourceMappingURL=find-dependencies.js.map