MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / adcpError

Function adcpError

server/src/training-agent/task-handlers.ts:51–61  ·  view source on GitHub ↗

Build a structured MCP error response for tool calls (L3 error compliance).

(code: string, opts: { message: string; details?: unknown; recovery?: string; field?: string }, context?: unknown)

Source from the content-addressed store, hash-verified

49
50/** Build a structured MCP error response for tool calls (L3 error compliance). */
51function adcpError(code: string, opts: { message: string; details?: unknown; recovery?: string; field?: string }, context?: unknown) {
52 const errorObj = { code, ...opts };
53 const body = context !== undefined
54 ? { adcp_error: errorObj, context }
55 : { adcp_error: errorObj };
56 return {
57 isError: true,
58 content: [{ type: 'text' as const, text: JSON.stringify(body) }],
59 structuredContent: body,
60 };
61}
62
63// Derive types from SDK request types that aren't re-exported from main entry
64type PackageUpdate = NonNullable<UpdateMediaBuyRequest['packages']>[number];

Callers 1

dispatchCallToolFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected