code: def get_exec_metadata_tool(llm, executor, model_kwargs) -> Callable:
      def mdb_exec_metadata_call(query: str) -> str:
          try:
              parts = query.replace("`", "").split(".")
              assert (
                  1 <= len(parts) <= 2
              ), "query must be in the format: `integration` or `integration.table`"
  
              integration = parts[0]
              integrations = executor.session.integration_controller
              handler = integrations.get_handler(integration)
  
              if len(parts) == 1:
                  df = handler.get_tables().data_frame
                  data = f'The integration `{integration}` has {df.shape[0]} tables: {", ".join(list(df["TABLE_NAME"].values))}'  # noqa
  
              if len(parts) == 2:
                  df = handler.get_tables().data_frame
                  table_name = parts[-1]
                  try:
                      table_name_col = (
                          "TABLE_NAME"
                          if "TABLE_NAME" in df.columns
                          else "table_name"
                      )
                      mdata = (
                          df[df[table_name_col] == table_name]
                          .iloc[0]
                          .to_list()
                      )
                      if len(mdata) == 3:
                          _, nrows, table_type = mdata
                          data = f"Metadata for table {table_name}:\n\tRow count: {nrows}\n\tType: {table_type}\n"
                      elif len(mdata) == 2:
                          nrows = mdata
                          data = f"Metadata for table {table_name}:\n\tRow count: {nrows}\n"
                      else:
                          data = f"Metadata for table {table_name}:\n"
                      fields = (
                          handler.get_columns(table_name)
                          .data_frame["Field"]
                          .to_list()
                      )
                      types = (
                          handler.get_columns(table_name)
                          .data_frame["Type"]
                          .to_list()
                      )
                      data += f"List of columns and types:\n"
                      data += "\n".join(
                          [
                              f"\tColumn: `{field}`\tType: `{typ}`"
                              for field, typ in zip(fields, types)
                          ]
                      )
                  except:
                      data = f"Table {table_name} not found."
          except Exception as e:
              data = f"mindsdb tool failed with error:\n{str(e)}"  # let the agent know
  
          # summarize output if needed
          data = summarize_if_overflowed(
              data, llm, model_kwargs["max_tokens"]
          )
  
          return data
  
      return mdb_exec_metadata_call
  
file_path: mindsdb/mindsdb/integrations/handlers/langchain_handler/tools.py
imports: import tiktoken
  from typing import Callable
  from mindsdb_sql import parse_sql, Insert
  from langchain.utilities import GoogleSerperAPIWrapper
  from langchain.prompts import PromptTemplate
  from langchain.agents import load_tools, Tool
  from langchain.chains.llm import LLMChain
  from langchain.text_splitter import CharacterTextSplitter
  from langchain.chains.combine_documents.stuff import StuffDocumentsChain
  from langchain.chains import ReduceDocumentsChain, MapReduceDocumentsChain
  from mindsdb.interfaces.skills.skill_tool import make_tools_from_skill
label_desc: Use image node_id 2 for calling a global function with example usage: get_exec_metadata_tool(llm, executor, model_kwargs) and returns: mdb_exec_metadata_call, data