Skip to main content
Glama

connector-call-test

Execute connector calls with real input parameters to test functionality and verify results using actual data.

Instructions

#Test a Connector Call

Execute a connector call with provided input parameters for testing purposes. This allows you to test connector calls with real data and see the results.

Parameter Usage:

  • Each parameter requires a "name" (the field name) and a "value" (the actual data)

  • Parameter names must match the connector call's defined parameters

  • Values can be any JSON value (string, number, boolean, object, array). The connector call specifies the expected input data type. Important: In case you miss properties in the result, check whether a datatype other than Any is assigned as output data type and whether validateOut is set to true - in this case values will be filtered to fit the datatype.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectorNameYes
callNameYes
parametersNoInput parameters for the connector call

Implementation Reference

  • The handler function that implements the core logic of the 'connector-call-test' tool. It fetches the connector call's input parameters, matches them with provided test values (or uses constants), retrieves data types, builds a test request, calls the Simplifier client's testConnectorCall method with tracking, and formats the response as success or error with result or error details.
    }, async ({ connectorName, callName, parameters }) => {
      return wrapToolResult(`test connector call ${connectorName}.${callName}`, async () => {
        const connectorParameters =
          (await simplifier.getConnectorCall(connectorName, callName))
            .connectorCallParameters
            .filter(cparam => cparam.isInput)
        const testParameters: ConnectorTestParameter[]  = await Promise.all(connectorParameters.map(async cparam => {
          const dataType = await simplifier.getDataTypeByName(cparam.dataType.name)
          const value = parameters.find(p => p.name === cparam.name)?.value || parameters.find(p => p.name === cparam.alias)?.value || cparam.constValue
          return {
            name: cparam.name,
            constValue: cparam.constValue,
            value: value,
            alias: cparam?.alias,
            dataType: dataType,
            transfer: value !== undefined,
          } satisfies ConnectorTestParameter;
        }))
    
        const testRequest: ConnectorTestRequest = {
          parameters: testParameters
        };
    
        const trackingKey = trackingToolPrefix + toolNameConnectorCallTest
        const result = await simplifier.testConnectorCall(connectorName, callName, testRequest, trackingKey);
    
        // Format the response nicely
        if (result.success) {
          return {
            success: true,
            message: `Connector call '${callName}' executed successfully`,
            result: result.result,
          };
        } else {
          return {
            success: false,
            message: `Connector call '${callName}' execution failed`,
            error: result.error || result.message || "Unknown error",
          };
        }
      });
    });
  • Zod input schema defining the parameters for the tool: connectorName (string), callName (string), and optional parameters array each with name (string) and value (unknown JSON).
    inputSchema: {
      connectorName: z.string(),
      callName: z.string(),
      parameters: z.array(z.object({
        name: z.string().describe("Parameter name"),
        value: z.unknown().describe("Parameter value - can be any JSON value")
      })).optional().default([]).describe("Input parameters for the connector call")
    },
  • The registration of the 'connector-call-test' tool on the MCP server, including the tool name constant, call to server.registerTool with description, input schema, annotations, and handler function.
    const toolNameConnectorCallTest = "connector-call-test"
    server.registerTool(toolNameConnectorCallTest,
      {
        description: connectorTestDescription,
        inputSchema: {
          connectorName: z.string(),
          callName: z.string(),
          parameters: z.array(z.object({
            name: z.string().describe("Parameter name"),
            value: z.unknown().describe("Parameter value - can be any JSON value")
          })).optional().default([]).describe("Input parameters for the connector call")
        },
        annotations: {
          title: "Test a Connector Call",
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: true,
        },
      }, async ({ connectorName, callName, parameters }) => {
        return wrapToolResult(`test connector call ${connectorName}.${callName}`, async () => {
          const connectorParameters =
            (await simplifier.getConnectorCall(connectorName, callName))
              .connectorCallParameters
              .filter(cparam => cparam.isInput)
          const testParameters: ConnectorTestParameter[]  = await Promise.all(connectorParameters.map(async cparam => {
            const dataType = await simplifier.getDataTypeByName(cparam.dataType.name)
            const value = parameters.find(p => p.name === cparam.name)?.value || parameters.find(p => p.name === cparam.alias)?.value || cparam.constValue
            return {
              name: cparam.name,
              constValue: cparam.constValue,
              value: value,
              alias: cparam?.alias,
              dataType: dataType,
              transfer: value !== undefined,
            } satisfies ConnectorTestParameter;
          }))
    
          const testRequest: ConnectorTestRequest = {
            parameters: testParameters
          };
    
          const trackingKey = trackingToolPrefix + toolNameConnectorCallTest
          const result = await simplifier.testConnectorCall(connectorName, callName, testRequest, trackingKey);
    
          // Format the response nicely
          if (result.success) {
            return {
              success: true,
              message: `Connector call '${callName}' executed successfully`,
              result: result.result,
            };
          } else {
            return {
              success: false,
              message: `Connector call '${callName}' execution failed`,
              error: result.error || result.message || "Unknown error",
            };
          }
        });
      });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SimplifierIO/simplifier-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server