| 99 | > = R extends Rpc.Any ? RpcMessage.Request<R> : never |
| 100 | |
| 101 | const 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 | |
| 114 | const toInternalServerNotification = ( |
| 115 | message: ServerNotificationRequest |