(
request: ClientRequest,
schema: T,
tabKey?: keyof typeof errors,
)
| 848 | }; |
| 849 | |
| 850 | const sendMCPRequest = async <T extends AnySchema>( |
| 851 | request: ClientRequest, |
| 852 | schema: T, |
| 853 | tabKey?: keyof typeof errors, |
| 854 | ): Promise<SchemaOutput<T>> => { |
| 855 | try { |
| 856 | const response = await makeRequest(request, schema); |
| 857 | if (tabKey !== undefined) { |
| 858 | clearError(tabKey); |
| 859 | } |
| 860 | return response; |
| 861 | } catch (e) { |
| 862 | const errorString = (e as Error).message ?? String(e); |
| 863 | if (tabKey !== undefined) { |
| 864 | setErrors((prev) => ({ |
| 865 | ...prev, |
| 866 | [tabKey]: errorString, |
| 867 | })); |
| 868 | } |
| 869 | throw e; |
| 870 | } |
| 871 | }; |
| 872 | |
| 873 | const listResources = async () => { |
| 874 | const response = await sendMCPRequest( |
no test coverage detected