ailoy-web
    Preparing search index...

    Class MCPClient

    MCPClient provides a high-level interface for interacting with an internal MCP client using the official MCP JavaScript SDK.

    • It manages a single Client instance and connects via provided transport (except StdioClientTransport).
    • The connection lifecycle is handled through the start() and cleanup() methods.
    • Tools can be discovered with listTools(), and invoked using callTool().
    Index

    Constructors

    Methods

    • Parameters

      • tool: objectOutputType<
            { name: ZodString; title: ZodOptional<ZodString> } & {
                _meta: ZodOptional<
                    ZodObject<
                        {},
                        "passthrough",
                        ZodTypeAny,
                        objectOutputType<{}, ZodTypeAny, "passthrough">,
                        objectInputType<{}, ZodTypeAny, "passthrough">,
                    >,
                >;
                annotations: ZodOptional<
                    ZodObject<
                        {
                            destructiveHint: ZodOptional<ZodBoolean>;
                            idempotentHint: ZodOptional<ZodBoolean>;
                            openWorldHint: ZodOptional<ZodBoolean>;
                            readOnlyHint: ZodOptional<ZodBoolean>;
                            title: ZodOptional<ZodString>;
                        },
                        "passthrough",
                        ZodTypeAny,
                        objectOutputType<
                            {
                                destructiveHint: ZodOptional<ZodBoolean>;
                                idempotentHint: ZodOptional<ZodBoolean>;
                                openWorldHint: ZodOptional<ZodBoolean>;
                                readOnlyHint: ZodOptional<ZodBoolean>;
                                title: ZodOptional<ZodString>;
                            },
                            ZodTypeAny,
                            "passthrough",
                        >,
                        objectInputType<
                            {
                                destructiveHint: ZodOptional<ZodBoolean>;
                                idempotentHint: ZodOptional<ZodBoolean>;
                                openWorldHint: ZodOptional<ZodBoolean>;
                                readOnlyHint: ZodOptional<ZodBoolean>;
                                title: ZodOptional<ZodString>;
                            },
                            ZodTypeAny,
                            "passthrough",
                        >,
                    >,
                >;
                description: ZodOptional<ZodString>;
                inputSchema: ZodObject<
                    {
                        properties: ZodOptional<
                            ZodObject<
                                {},
                                "passthrough",
                                ZodTypeAny,
                                objectOutputType<{}, ZodTypeAny, "passthrough">,
                                objectInputType<{}, ZodTypeAny, "passthrough">,
                            >,
                        >;
                        required: ZodOptional<ZodArray<ZodString, "many">>;
                        type: ZodLiteral<"object">;
                    },
                    "passthrough",
                    ZodTypeAny,
                    objectOutputType<
                        {
                            properties: ZodOptional<
                                ZodObject<
                                    {},
                                    "passthrough",
                                    ZodTypeAny,
                                    objectOutputType<{}, ZodTypeAny, "passthrough">,
                                    objectInputType<{}, ZodTypeAny, "passthrough">,
                                >,
                            >;
                            required: ZodOptional<ZodArray<ZodString, "many">>;
                            type: ZodLiteral<"object">;
                        },
                        ZodTypeAny,
                        "passthrough",
                    >,
                    objectInputType<
                        {
                            properties: ZodOptional<
                                ZodObject<
                                    {},
                                    "passthrough",
                                    ZodTypeAny,
                                    objectOutputType<{}, ZodTypeAny, "passthrough">,
                                    objectInputType<{}, ZodTypeAny, "passthrough">,
                                >,
                            >;
                            required: ZodOptional<ZodArray<ZodString, "many">>;
                            type: ZodLiteral<"object">;
                        },
                        ZodTypeAny,
                        "passthrough",
                    >,
                >;
                outputSchema: ZodOptional<
                    ZodObject<
                        {
                            properties: ZodOptional<
                                ZodObject<
                                    {},
                                    "passthrough",
                                    ZodTypeAny,
                                    objectOutputType<{}, ZodTypeAny, "passthrough">,
                                    objectInputType<{}, ZodTypeAny, "passthrough">,
                                >,
                            >;
                            required: ZodOptional<ZodArray<ZodString, "many">>;
                            type: ZodLiteral<"object">;
                        },
                        "passthrough",
                        ZodTypeAny,
                        objectOutputType<
                            {
                                properties: ZodOptional<
                                    ZodObject<
                                        {},
                                        "passthrough",
                                        ZodTypeAny,
                                        objectOutputType<{}, ZodTypeAny, "passthrough">,
                                        objectInputType<{}, ZodTypeAny, "passthrough">,
                                    >,
                                >;
                                required: ZodOptional<ZodArray<ZodString, "many">>;
                                type: ZodLiteral<"object">;
                            },
                            ZodTypeAny,
                            "passthrough",
                        >,
                        objectInputType<
                            {
                                properties: ZodOptional<
                                    ZodObject<
                                        {},
                                        "passthrough",
                                        ZodTypeAny,
                                        objectOutputType<{}, ZodTypeAny, "passthrough">,
                                        objectInputType<{}, ZodTypeAny, "passthrough">,
                                    >,
                                >;
                                required: ZodOptional<ZodArray<ZodString, "many">>;
                                type: ZodLiteral<"object">;
                            },
                            ZodTypeAny,
                            "passthrough",
                        >,
                    >,
                >;
            },
            ZodTypeAny,
            "passthrough",
        >
      • Optionalinputs: { [x: string]: unknown }

      Returns Promise<any[]>

    • Returns Promise<void>

    • Returns Promise<boolean>

    • Returns Promise<
          objectOutputType<
              { name: ZodString; title: ZodOptional<ZodString> } & {
                  _meta: ZodOptional<
                      ZodObject<
                          {},
                          "passthrough",
                          ZodTypeAny,
                          objectOutputType<{}, ZodTypeAny, "passthrough">,
                          objectInputType<{}, ZodTypeAny, "passthrough">,
                      >,
                  >;
                  annotations: ZodOptional<
                      ZodObject<
                          {
                              destructiveHint: ZodOptional<ZodBoolean>;
                              idempotentHint: ZodOptional<ZodBoolean>;
                              openWorldHint: ZodOptional<ZodBoolean>;
                              readOnlyHint: ZodOptional<ZodBoolean>;
                              title: ZodOptional<ZodString>;
                          },
                          "passthrough",
                          ZodTypeAny,
                          objectOutputType<
                              {
                                  destructiveHint: ZodOptional<ZodBoolean>;
                                  idempotentHint: ZodOptional<ZodBoolean>;
                                  openWorldHint: ZodOptional<ZodBoolean>;
                                  readOnlyHint: ZodOptional<ZodBoolean>;
                                  title: ZodOptional<ZodString>;
                              },
                              ZodTypeAny,
                              "passthrough",
                          >,
                          objectInputType<
                              {
                                  destructiveHint: ZodOptional<ZodBoolean>;
                                  idempotentHint: ZodOptional<ZodBoolean>;
                                  openWorldHint: ZodOptional<ZodBoolean>;
                                  readOnlyHint: ZodOptional<ZodBoolean>;
                                  title: ZodOptional<ZodString>;
                              },
                              ZodTypeAny,
                              "passthrough",
                          >,
                      >,
                  >;
                  description: ZodOptional<ZodString>;
                  inputSchema: ZodObject<
                      {
                          properties: ZodOptional<
                              ZodObject<
                                  {},
                                  "passthrough",
                                  ZodTypeAny,
                                  objectOutputType<{}, ZodTypeAny, "passthrough">,
                                  objectInputType<{}, ZodTypeAny, "passthrough">,
                              >,
                          >;
                          required: ZodOptional<ZodArray<ZodString, "many">>;
                          type: ZodLiteral<"object">;
                      },
                      "passthrough",
                      ZodTypeAny,
                      objectOutputType<
                          {
                              properties: ZodOptional<
                                  ZodObject<
                                      {},
                                      "passthrough",
                                      ZodTypeAny,
                                      objectOutputType<(...), (...), (...)>,
                                      objectInputType<(...), (...), (...)>,
                                  >,
                              >;
                              required: ZodOptional<ZodArray<ZodString, "many">>;
                              type: ZodLiteral<"object">;
                          },
                          ZodTypeAny,
                          "passthrough",
                      >,
                      objectInputType<
                          {
                              properties: ZodOptional<
                                  ZodObject<
                                      {},
                                      "passthrough",
                                      ZodTypeAny,
                                      objectOutputType<(...), (...), (...)>,
                                      objectInputType<(...), (...), (...)>,
                                  >,
                              >;
                              required: ZodOptional<ZodArray<ZodString, "many">>;
                              type: ZodLiteral<"object">;
                          },
                          ZodTypeAny,
                          "passthrough",
                      >,
                  >;
                  outputSchema: ZodOptional<
                      ZodObject<
                          {
                              properties: ZodOptional<
                                  ZodObject<
                                      {},
                                      "passthrough",
                                      ZodTypeAny,
                                      objectOutputType<(...), (...), (...)>,
                                      objectInputType<(...), (...), (...)>,
                                  >,
                              >;
                              required: ZodOptional<ZodArray<ZodString, "many">>;
                              type: ZodLiteral<"object">;
                          },
                          "passthrough",
                          ZodTypeAny,
                          objectOutputType<
                              {
                                  properties: ZodOptional<
                                      ZodObject<(...), (...), (...), (...), (...)>,
                                  >;
                                  required: ZodOptional<ZodArray<(...), (...)>>;
                                  type: ZodLiteral<"object">;
                              },
                              ZodTypeAny,
                              "passthrough",
                          >,
                          objectInputType<
                              {
                                  properties: ZodOptional<
                                      ZodObject<(...), (...), (...), (...), (...)>,
                                  >;
                                  required: ZodOptional<ZodArray<(...), (...)>>;
                                  type: ZodLiteral<"object">;
                              },
                              ZodTypeAny,
                              "passthrough",
                          >,
                      >,
                  >;
              },
              ZodTypeAny,
              "passthrough",
          >[],
      >