MCPcopy Create free account
hub / github.com/Effect-TS/effect / validateStructuredContent

Function validateStructuredContent

packages/effect/src/unstable/ai/McpServer.ts:101–112  ·  view source on GitHub ↗
(
  toolName: string,
  value: unknown
)

Source from the content-addressed store, hash-verified

99> = R extends Rpc.Any ? RpcMessage.Request<R> : never
100
101const validateStructuredContent = (
102 toolName: string,
103 value: unknown
104): Effect.Effect<Schema.Json, McpCore.ToolResultProjectionError> =>
105 Schema.is(Schema.Json)(value)
106 ? Effect.succeed(value)
107 : Effect.fail(
108 new McpCore.ToolResultProjectionError({
109 name: toolName,
110 message: `Tool '${toolName}' returned structured content that is not valid JSON`
111 })
112 )
113
114const toInternalServerNotification = (
115 message: ServerNotificationRequest

Callers 1

McpServerClass · 0.85

Calls 3

isMethod · 0.65
succeedMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected