MCPcopy Create free account
hub / github.com/modelcontextprotocol/inspector / sendMCPRequest

Function sendMCPRequest

client/src/App.tsx:850–871  ·  view source on GitHub ↗
(
    request: ClientRequest,
    schema: T,
    tabKey?: keyof typeof errors,
  )

Source from the content-addressed store, hash-verified

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(

Callers 11

listResourcesFunction · 0.85
listResourceTemplatesFunction · 0.85
getPromptFunction · 0.85
readResourceFunction · 0.85
subscribeToResourceFunction · 0.85
unsubscribeFromResourceFunction · 0.85
listPromptsFunction · 0.85
listToolsFunction · 0.85
callToolFunction · 0.85
sendLogLevelRequestFunction · 0.85
AppFunction · 0.85

Calls 2

makeRequestFunction · 0.85
clearErrorFunction · 0.85

Tested by

no test coverage detected