Skip to content

Commit d138327

Browse files
committed
Fix critical TypeScript type errors in MCP server
- Fix unsafe type assertions by adding null checks in index.ts - Add missing type property to UpdateNodeArgs interface - Ensure consistent parameter handling with proper validation
1 parent dbcec32 commit d138327

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

packages/mcp-server/src/index.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -729,10 +729,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
729729

730730
// Priority Management Commands
731731
case 'update_priorities':
732-
return await graphService.updatePriorities(args as UpdatePrioritiesArgs);
732+
return await graphService.updatePriorities((args || {}) as UpdatePrioritiesArgs);
733733

734734
case 'bulk_update_priorities':
735-
return await graphService.bulkUpdatePriorities(args as BulkUpdatePrioritiesArgs);
735+
return await graphService.bulkUpdatePriorities((args || {}) as BulkUpdatePrioritiesArgs);
736736

737737
case 'get_priority_insights':
738738
return await graphService.getPriorityInsights(args as GetPriorityInsightsArgs);
@@ -746,26 +746,26 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
746746

747747
// Advanced Operations
748748
case 'bulk_operations':
749-
return await graphService.bulkOperations(args as BulkOperationsArgs);
749+
return await graphService.bulkOperations((args || {}) as BulkOperationsArgs);
750750

751751
case 'get_workload_analysis':
752752
return await graphService.getWorkloadAnalysis(args as Record<string, unknown>);
753753

754754
// Contributor-Focused Commands
755755
case 'get_contributor_priorities':
756-
return await graphService.getContributorPriorities(args as GetContributorPrioritiesArgs);
756+
return await graphService.getContributorPriorities((args || {}) as GetContributorPrioritiesArgs);
757757

758758
case 'get_contributor_workload':
759-
return await graphService.getContributorWorkload(args as GetContributorWorkloadArgs);
759+
return await graphService.getContributorWorkload((args || {}) as GetContributorWorkloadArgs);
760760

761761
case 'find_contributors_by_project':
762762
return await graphService.findContributorsByProject(args as Record<string, unknown>);
763763

764764
case 'get_project_team':
765-
return await graphService.getProjectTeam(args as Record<string, unknown>);
765+
return await graphService.getProjectTeam(args || {});
766766

767767
case 'get_contributor_expertise':
768-
return await graphService.getContributorExpertise(args as Record<string, unknown>);
768+
return await graphService.getContributorExpertise(args || {});
769769

770770
case 'get_collaboration_network':
771771
return await graphService.getCollaborationNetwork(args as GetCollaborationNetworkArgs);
@@ -775,25 +775,25 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
775775

776776
// Graph Management Commands - Type assertions needed for MCP dynamic arguments
777777
case 'create_graph':
778-
return await graphService.createGraph(args as CreateGraphArgs);
778+
return await graphService.createGraph((args || {}) as CreateGraphArgs);
779779

780780
case 'list_graphs':
781781
return await graphService.listGraphs(args as ListGraphsArgs);
782782

783783
case 'get_graph_details':
784-
return await graphService.getGraphDetails(args as GetGraphDetailsArgs);
784+
return await graphService.getGraphDetails((args || {}) as GetGraphDetailsArgs);
785785

786786
case 'update_graph':
787-
return await graphService.updateGraph(args as UpdateGraphArgs);
787+
return await graphService.updateGraph((args || {}) as UpdateGraphArgs);
788788

789789
case 'delete_graph':
790-
return await graphService.deleteGraph(args as DeleteGraphArgs);
790+
return await graphService.deleteGraph((args || {}) as DeleteGraphArgs);
791791

792792
case 'archive_graph':
793-
return await graphService.archiveGraph(args as ArchiveGraphArgs);
793+
return await graphService.archiveGraph((args || {}) as ArchiveGraphArgs);
794794

795795
case 'clone_graph':
796-
return await graphService.cloneGraph(args as CloneGraphArgs);
796+
return await graphService.cloneGraph((args || {}) as CloneGraphArgs);
797797

798798
default:
799799
throw new Error(`Unknown tool: ${name}`);

packages/mcp-server/src/services/graph-service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export interface UpdateNodeArgs {
6868
node_id?: string;
6969
title?: string;
7070
description?: string;
71+
type?: NodeType;
7172
status?: NodeStatus;
7273
contributor_ids?: string[];
7374
metadata?: NodeMetadata;

0 commit comments

Comments
 (0)