MCPcopy
hub / github.com/codeaashu/claude-code / validateInput

Function validateInput

src/tools/TaskStopTool/TaskStopTool.ts:60–91  ·  view source on GitHub ↗
({ task_id, shell_id }, { getAppState })

Source from the content-addressed store, hash-verified

58 return input.task_id ?? input.shell_id ?? ''
59 },
60 async validateInput({ task_id, shell_id }, { getAppState }) {
61 // Support both task_id and shell_id (deprecated KillShell compat)
62 const id = task_id ?? shell_id
63 if (!id) {
64 return {
65 result: false,
66 message: 'Missing required parameter: task_id',
67 errorCode: 1,
68 }
69 }
70
71 const appState = getAppState()
72 const task = appState.tasks?.[id] as TaskStateBase | undefined
73
74 if (!task) {
75 return {
76 result: false,
77 message: `No task found with ID: ${id}`,
78 errorCode: 1,
79 }
80 }
81
82 if (task.status !== 'running') {
83 return {
84 result: false,
85 message: `Task ${id} is not running (status: ${task.status})`,
86 errorCode: 3,
87 }
88 }
89
90 return { result: true }
91 },
92 async description() {
93 return `Stop a running background task by ID`
94 },

Callers

nothing calls this directly

Calls 1

getAppStateFunction · 0.50

Tested by

no test coverage detected