Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.
This repository was archived by the owner on May 21, 2026. It is now read-only.

[BUG] Type mismatch when using the example code. #22

Description

@Crymzix

Getting a type mismatch error as described in a previous issue #18 when using the basic usage code. Seems like it's not fully resolved.

Type 'BaseChatModel<BaseChatModelCallOptions, AIMessageChunk>' is not assignable to type 'BaseLanguageModelInterface<any, BaseLanguageModelCallOptions>'.
  Types of property 'generatePrompt' are incompatible.
    Type '(promptValues: BasePromptValueInterface[], options?: string[] | BaseChatModelCallOptions | undefined, callbacks?: Callbacks | undefined) => Promise<...>' is not assignable to type '(promptValues: BasePromptValueInterface[], options?: string[] | BaseLanguageModelCallOptions | undefined, callbacks?: Callbacks | undefined) => Promise<...>'.
      Types of parameters 'options' and 'options' are incompatible.
        Type 'string[] | BaseLanguageModelCallOptions | undefined' is not assignable to type 'string[] | BaseChatModelCallOptions | undefined'.
          Type 'BaseLanguageModelCallOptions' is not assignable to type 'string[] | BaseChatModelCallOptions | undefined'.
            Type 'BaseLanguageModelCallOptions' is not assignable to type 'BaseChatModelCallOptions'.
              Type 'import("/node_modules/mcp-use/node_modules/@langchain/core/dist/language_models/base").BaseLanguageModelCallOptions' is not assignable to type 'import("/node_modules/@langchain/core/dist/language_models/base").BaseLanguageModelCallOptions'.
                Types of property 'callbacks' are incompatible.
                  Type 'import("/node_modules/mcp-use/node_modules/@langchain/core/dist/callbacks/manager").Callbacks | undefined' is not assignable to type 'import("/node_modules/@langchain/core/dist/callbacks/manager").Callbacks | undefined'.
                    Type 'CallbackManager' is not assignable to type 'Callbacks | undefined'.
                      Type 'import("/node_modules/mcp-use/node_modules/@langchain/core/dist/callbacks/manager").CallbackManager' is not assignable to type 'import("/node_modules/@langchain/core/dist/callbacks/manager").CallbackManager'.
                        The types returned by 'handleLLMStart(...)' are incompatible between these types.
                          Type 'Promise<import("/node_modules/mcp-use/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun[]>' is not assignable to type 'Promise<import("/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun[]>'.
                            Type 'import("node_modules/mcp-use/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun[]' is not assignable to type 'import("/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun[]'.
                              Type 'import("/node_modules/mcp-use/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun' is not assignable to type 'import("/node_modules/@langchain/core/dist/callbacks/manager").CallbackManagerForLLMRun'.
                                Property 'inheritableHandlers' is protected but type 'BaseRunManager' is not a class derived from 'BaseRunManager'.ts(2322)
mcp_agent.d.ts(43, 9): The expected type comes from property 'llm' which is declared here on type '{ llm?: BaseLanguageModelInterface<any, BaseLanguageModelCallOptions> | undefined; client?: MCPClient | undefined; ... 16 more ...; baseUrl?: string | undefined; }'
// package.json
"@langchain/community": "^0.3.53",
"@langchain/core": "^0.3.72",
"@langchain/ollama": "^0.2.3",
"@langchain/openai": "^0.6.9",
"mcp-use": "^0.1.17"

Note that casting the chat model object to any works but obviously is not ideal here.

const agent = new MCPAgent({ llm: llm as any, client, maxSteps: 20 })

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions