MCPcopy
hub / github.com/coder/mux / parseTaskAiOverrides

Function parseTaskAiOverrides

src/node/services/tools/task.ts:119–146  ·  view source on GitHub ↗

* Parse the optional `model`/`thinking` overrides supplied on a task launch, * reusing the exact parsing the UI uses (`normalizeModelInput` for model alias * resolution; `parseThinkingInput` for named levels OR numeric indices). Numeric * thinking indices stay deferred as a `ParsedThinkingInput`

(args: { model?: string | null; thinking?: string | null })

Source from the content-addressed store, hash-verified

117 * descriptive error on invalid input so the model can correct the call.
118 */
119function parseTaskAiOverrides(args: { model?: string | null; thinking?: string | null }): {
120 modelString?: string;
121 thinkingLevel?: ParsedThinkingInput;
122} {
123 const overrides: { modelString?: string; thinkingLevel?: ParsedThinkingInput } = {};
124
125 if (args.model != null) {
126 const normalized = normalizeModelInput(args.model);
127 if (normalized.model == null) {
128 throw new Error(
129 `task tool: invalid model "${args.model}". Provide a known alias or a "provider:model" string.`
130 );
131 }
132 overrides.modelString = normalized.model;
133 }
134
135 if (args.thinking != null) {
136 const parsed = parseThinkingInput(args.thinking);
137 if (parsed == null) {
138 throw new Error(
139 `task tool: invalid thinking "${args.thinking}". Use a level name (off, low, medium, high, xhigh, max) or a numeric index.`
140 );
141 }
142 overrides.thinkingLevel = parsed;
143 }
144
145 return overrides;
146}
147
148interface SpawnedTaskInfo {
149 taskId: string;

Callers 1

createTaskToolFunction · 0.85

Calls 2

normalizeModelInputFunction · 0.90
parseThinkingInputFunction · 0.90

Tested by

no test coverage detected