MCPcopy
hub / github.com/RedPlanetHQ/core / executeCodingTool

Function executeCodingTool

packages/cli/src/server/tools/coding-tools.ts:1032–1065  ·  view source on GitHub ↗
(
	toolName: string,
	params: Record<string, unknown>,
	logger?: Logger,
)

Source from the content-addressed store, hash-verified

1030// ============ Dispatch ============
1031
1032export async function executeCodingTool(
1033 toolName: string,
1034 params: Record<string, unknown>,
1035 logger?: Logger,
1036): Promise<{success: boolean; result?: unknown; error?: string}> {
1037 try {
1038 switch (toolName) {
1039 case 'coding_ask':
1040 return await handleAsk(AskSchema.parse(params), logger);
1041 case 'coding_close_session':
1042 return handleCloseSession(CloseSessionSchema.parse(params));
1043 case 'coding_close_all':
1044 return handleCloseAll();
1045 case 'coding_read_session':
1046 return await handleReadSession(ReadSessionSchema.parse(params));
1047 case 'coding_list_sessions':
1048 return await handleListSessions(ListSessionsSchema.parse(params));
1049 case 'coding_search_sessions':
1050 return await handleSearchSessions(SearchSessionsSchema.parse(params));
1051 case 'coding_list_agents':
1052 return handleListAgents();
1053 default:
1054 return {success: false, error: `Unknown tool: ${toolName}`};
1055 }
1056 } catch (err) {
1057 if (err instanceof zod.ZodError) {
1058 return {success: false, error: `Invalid parameters: ${err.message}`};
1059 }
1060 return {
1061 success: false,
1062 error: err instanceof Error ? err.message : 'Unknown error',
1063 };
1064 }
1065}

Callers 4

runReadSessionFunction · 0.90
readOnceFunction · 0.90
runListAgentsFunction · 0.90
runListSessionsFunction · 0.90

Calls 8

handleAskFunction · 0.85
handleCloseSessionFunction · 0.85
handleCloseAllFunction · 0.85
handleReadSessionFunction · 0.85
handleListSessionsFunction · 0.85
handleSearchSessionsFunction · 0.85
handleListAgentsFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected