MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / call

Function call

src/utils/computerUse/wrapper.tsx:286–320  ·  view source on GitHub ↗
(args, context: ToolUseContext)

Source from the content-addressed store, hash-verified

284
285export function getComputerUseMCPToolOverrides(toolName: string): ComputerUseMCPToolOverrides {
286 const call: CallOverride = async (args, context: ToolUseContext) => {
287 currentToolUseContext = context;
288 const { dispatch } = getOrBind();
289
290 const { telemetry, ...result } = await dispatch(toolName, args);
291
292 if (telemetry?.error_kind) {
293 logForDebugging(`[Computer Use MCP] ${toolName} error_kind=${telemetry.error_kind}`);
294 }
295
296 // MCP content blocks → Anthropic API blocks. CU only produces text and
297 // pre-sized JPEG (executor.ts computeTargetDims → targetImageSize), so
298 // unlike the generic MCP path there's no resize needed — the MCP image
299 // shape just maps to the API's base64-source shape. The package's result
300 // type admits audio/resource too, but CU's handleToolCall never emits
301 // those; the fallthrough coerces them to empty text.
302 const data = Array.isArray(result.content)
303 ? result.content.map(item =>
304 item.type === 'image'
305 ? {
306 type: 'image' as const,
307 source: {
308 type: 'base64' as const,
309 media_type: item.mimeType ?? detectImageFormatFromBase64(item.data),
310 data: item.data,
311 },
312 }
313 : {
314 type: 'text' as const,
315 text: item.type === 'text' ? item.text : '',
316 },
317 )
318 : result.content;
319 return { data };
320 };
321
322 return {
323 ...getComputerUseMCPRenderingOverrides(toolName),

Callers

nothing calls this directly

Calls 4

getOrBindFunction · 0.85
dispatchFunction · 0.85
logForDebuggingFunction · 0.50

Tested by

no test coverage detected