different-ai/openwork · error
${toolResultError(result)}
Error message
${toolResultError(result)} What it means
The admin-source tool runner in capability-registry.ts executes a matched capability via adminSource.execute; if the returned tool result has isError true, it throws toolError(toolResultError(result)), embedding the provider's error text via the message '${toolResultError(result)}'. Successful results are returned as toolResultValue(result).
Source
Thrown at ee/apps/den-api/src/mcp/capability-registry.ts:765
return matches.map((match) => ({ ...match, scriptPath: codemodeScriptPath("admin", parseAdminCapabilityName(match.name) ?? match.name) }))
},
enumerate: async (ctx) => {
const matches = await listAvailableAdminCapabilities(await ctx.resolvePlatformAdmin())
return matches.flatMap((match) => {
const toolName = parseAdminCapabilityName(match.name)
if (!toolName) return []
const parsed: Extract<ParsedCapability, { kind: "admin" }> = { kind: "admin", name: match.name, toolName }
return [contentLeaf({
namespace: "admin",
toolName,
capabilityName: match.name,
description: match.summary,
readOnly: false,
authority: "den",
input: isCodemodeJsonSchema(match.argumentsSchema) ? match.argumentsSchema : undefined,
run: async (args) => {
const result = await adminSource.execute(ctx, parsed, { name: match.name, body: args })
if (result.isError) throw toolError(toolResultError(result))
return toolResultValue(result)
},
})]
})
},
execute: async (ctx, parsed, input) => {
if (!parsedForKind(parsed, "admin") || !(await ctx.resolvePlatformAdmin())) {
return unknownCapabilityResult(input.name)
}
return (await executeAdminCapability(parsed.name, input.body)) ?? unknownCapabilityResult(input.name)
},
}
export const CAPABILITY_SOURCES: Record<CapabilitySourceKind, CapabilitySource> = {
catalog: catalogSource,
native: nativeSource,
externalMcp: externalMcpSource,
marketplace: marketplaceSource,View on GitHub (pinned to 2b7df46e8a)
Solutions
- Read the propagated toolResultError text for the underlying cause and correct the call arguments accordingly.
- Validate args against the tool's declared argumentsSchema (isCodemodeJsonSchema-validated input) before invoking.
- Re-sync the capability registry / connection so schemas match the provider's current API.
- Verify the admin connection's credentials and scopes if the error indicates authorization failure.
Example fix
// before: passing a string where the schema wants an array
run: execute(ctx, parsed, { name: 'crm.import', body: { rows: 'a,b,c' } })
// after: conform to match.argumentsSchema
run: execute(ctx, parsed, { name: 'crm.import', body: { rows: ['a', 'b', 'c'] } }) Defensive patterns
Strategy: validation
Validate before calling
if (match.argumentsSchema) {
const parsed = match.argumentsSchema.safeParse?.(args)
if (parsed && !parsed.success) throw new Error('args do not match tool argumentsSchema')
} Type guard
function isErroredToolResult(r: { isError: boolean }): r is { isError: true } {
return r.isError === true
} Try / catch
try {
result = await adminSource.execute(ctx, parsed, { name: match.name, body: args })
} catch (error) {
// error message carries toolResultError(result); inspect and correct args/permissions
logToolResultError(error)
throw error
} Prevention
- Validate arguments against the tool's argumentsSchema before every call.
- Re-sync the registry after provider schema changes.
- Keep admin connection credentials and scopes current.
- Prefer tools whose input schema is a valid codemode JSON schema so callers can validate.
When it happens
Trigger: Calling an admin-sourced MCP tool where adminSource.execute returns an isError tool result — the underlying capability/provider rejected the call: invalid arguments per the tool's argumentsSchema, provider-side execution failure, authz denial, or upstream service error.
Common situations: Arguments that don't satisfy match.argumentsSchema (missing required properties, wrong types); the admin connection's credentials lacking permission for the operation; upstream provider rejecting the operation or being down; schema drift between the registered tool and the provider's current API.
Related errors
- ${result.message}
- MCP_TOOL_REPORTED_ERROR
- MCP_TOOL_EXECUTION
- Failed to run MCP tool (${response.status}).
- MCP_PROVIDER_INVALID_PARAMS|MCP_PROVIDER_HTTP_403|MCP_PROVIDER_HTTP_429
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/9bc6e126cea769b9.
Report an issue: GitHub.