MindsDB 25.8.2.0__py3-none-any.whl → 25.9.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of MindsDB might be problematic. Click here for more details.

Files changed (101) hide show
  1. mindsdb/__about__.py +1 -1
  2. mindsdb/__main__.py +5 -45
  3. mindsdb/api/a2a/__init__.py +52 -0
  4. mindsdb/api/a2a/agent.py +17 -28
  5. mindsdb/api/a2a/common/server/server.py +17 -36
  6. mindsdb/api/a2a/common/server/task_manager.py +14 -28
  7. mindsdb/api/a2a/common/types.py +3 -4
  8. mindsdb/api/a2a/task_manager.py +43 -55
  9. mindsdb/api/a2a/utils.py +63 -0
  10. mindsdb/api/common/middleware.py +106 -0
  11. mindsdb/api/http/initialize.py +13 -15
  12. mindsdb/api/http/namespaces/agents.py +6 -7
  13. mindsdb/api/http/namespaces/auth.py +6 -14
  14. mindsdb/api/http/namespaces/config.py +0 -2
  15. mindsdb/api/http/namespaces/default.py +74 -106
  16. mindsdb/api/http/start.py +25 -44
  17. mindsdb/api/litellm/start.py +11 -10
  18. mindsdb/api/mcp/__init__.py +165 -0
  19. mindsdb/api/mysql/mysql_proxy/mysql_proxy.py +33 -64
  20. mindsdb/api/postgres/postgres_proxy/postgres_proxy.py +86 -85
  21. mindsdb/integrations/handlers/crate_handler/crate_handler.py +3 -7
  22. mindsdb/integrations/handlers/derby_handler/derby_handler.py +32 -34
  23. mindsdb/integrations/handlers/documentdb_handler/requirements.txt +1 -0
  24. mindsdb/integrations/handlers/dummy_data_handler/dummy_data_handler.py +12 -13
  25. mindsdb/integrations/handlers/google_books_handler/google_books_handler.py +45 -44
  26. mindsdb/integrations/handlers/google_calendar_handler/google_calendar_handler.py +101 -95
  27. mindsdb/integrations/handlers/google_content_shopping_handler/google_content_shopping_handler.py +129 -129
  28. mindsdb/integrations/handlers/google_fit_handler/google_fit_handler.py +59 -43
  29. mindsdb/integrations/handlers/google_search_handler/google_search_handler.py +38 -39
  30. mindsdb/integrations/handlers/informix_handler/informix_handler.py +5 -18
  31. mindsdb/integrations/handlers/maxdb_handler/maxdb_handler.py +22 -28
  32. mindsdb/integrations/handlers/monetdb_handler/monetdb_handler.py +3 -7
  33. mindsdb/integrations/handlers/mongodb_handler/mongodb_handler.py +53 -67
  34. mindsdb/integrations/handlers/mongodb_handler/requirements.txt +1 -0
  35. mindsdb/{api/mongo/utilities → integrations/handlers/mongodb_handler/utils}/mongodb_ast.py +43 -68
  36. mindsdb/{api/mongo/utilities → integrations/handlers/mongodb_handler/utils}/mongodb_parser.py +17 -25
  37. mindsdb/{api/mongo/utilities → integrations/handlers/mongodb_handler/utils}/mongodb_query.py +10 -16
  38. mindsdb/integrations/handlers/mongodb_handler/utils/mongodb_render.py +43 -69
  39. mindsdb/integrations/libs/base.py +1 -1
  40. mindsdb/interfaces/agents/constants.py +17 -2
  41. mindsdb/interfaces/agents/langchain_agent.py +83 -18
  42. mindsdb/interfaces/knowledge_base/controller.py +3 -1
  43. mindsdb/interfaces/skills/custom/text2sql/mindsdb_sql_toolkit.py +7 -1
  44. mindsdb/interfaces/skills/skill_tool.py +7 -1
  45. mindsdb/interfaces/skills/sql_agent.py +6 -2
  46. mindsdb/utilities/config.py +3 -155
  47. mindsdb/utilities/fs.py +10 -4
  48. mindsdb/utilities/log.py +0 -25
  49. mindsdb/utilities/starters.py +0 -39
  50. {mindsdb-25.8.2.0.dist-info → mindsdb-25.9.1.0.dist-info}/METADATA +265 -263
  51. {mindsdb-25.8.2.0.dist-info → mindsdb-25.9.1.0.dist-info}/RECORD +54 -98
  52. mindsdb/api/a2a/__main__.py +0 -144
  53. mindsdb/api/a2a/run_a2a.py +0 -86
  54. mindsdb/api/common/check_auth.py +0 -42
  55. mindsdb/api/http/gunicorn_wrapper.py +0 -17
  56. mindsdb/api/mcp/start.py +0 -205
  57. mindsdb/api/mongo/__init__.py +0 -0
  58. mindsdb/api/mongo/classes/__init__.py +0 -5
  59. mindsdb/api/mongo/classes/query_sql.py +0 -19
  60. mindsdb/api/mongo/classes/responder.py +0 -45
  61. mindsdb/api/mongo/classes/responder_collection.py +0 -34
  62. mindsdb/api/mongo/classes/scram.py +0 -86
  63. mindsdb/api/mongo/classes/session.py +0 -23
  64. mindsdb/api/mongo/functions/__init__.py +0 -19
  65. mindsdb/api/mongo/responders/__init__.py +0 -73
  66. mindsdb/api/mongo/responders/add_shard.py +0 -13
  67. mindsdb/api/mongo/responders/aggregate.py +0 -90
  68. mindsdb/api/mongo/responders/buildinfo.py +0 -17
  69. mindsdb/api/mongo/responders/coll_stats.py +0 -63
  70. mindsdb/api/mongo/responders/company_id.py +0 -25
  71. mindsdb/api/mongo/responders/connection_status.py +0 -22
  72. mindsdb/api/mongo/responders/count.py +0 -21
  73. mindsdb/api/mongo/responders/db_stats.py +0 -32
  74. mindsdb/api/mongo/responders/delete.py +0 -105
  75. mindsdb/api/mongo/responders/describe.py +0 -23
  76. mindsdb/api/mongo/responders/end_sessions.py +0 -13
  77. mindsdb/api/mongo/responders/find.py +0 -175
  78. mindsdb/api/mongo/responders/get_cmd_line_opts.py +0 -18
  79. mindsdb/api/mongo/responders/get_free_monitoring_status.py +0 -14
  80. mindsdb/api/mongo/responders/get_parameter.py +0 -23
  81. mindsdb/api/mongo/responders/getlog.py +0 -14
  82. mindsdb/api/mongo/responders/host_info.py +0 -28
  83. mindsdb/api/mongo/responders/insert.py +0 -270
  84. mindsdb/api/mongo/responders/is_master.py +0 -20
  85. mindsdb/api/mongo/responders/is_master_lower.py +0 -13
  86. mindsdb/api/mongo/responders/list_collections.py +0 -55
  87. mindsdb/api/mongo/responders/list_databases.py +0 -37
  88. mindsdb/api/mongo/responders/list_indexes.py +0 -22
  89. mindsdb/api/mongo/responders/ping.py +0 -13
  90. mindsdb/api/mongo/responders/recv_chunk_start.py +0 -13
  91. mindsdb/api/mongo/responders/replsetgetstatus.py +0 -13
  92. mindsdb/api/mongo/responders/sasl_continue.py +0 -34
  93. mindsdb/api/mongo/responders/sasl_start.py +0 -33
  94. mindsdb/api/mongo/responders/update_range_deletions.py +0 -12
  95. mindsdb/api/mongo/responders/whatsmyuri.py +0 -18
  96. mindsdb/api/mongo/server.py +0 -388
  97. mindsdb/api/mongo/start.py +0 -15
  98. mindsdb/api/mongo/utilities/__init__.py +0 -0
  99. {mindsdb-25.8.2.0.dist-info → mindsdb-25.9.1.0.dist-info}/WHEEL +0 -0
  100. {mindsdb-25.8.2.0.dist-info → mindsdb-25.9.1.0.dist-info}/licenses/LICENSE +0 -0
  101. {mindsdb-25.8.2.0.dist-info → mindsdb-25.9.1.0.dist-info}/top_level.txt +0 -0
@@ -15,9 +15,9 @@ from mindsdb.integrations.utilities.handlers.auth_utilities.exceptions import Au
15
15
  from .google_calendar_tables import GoogleCalendarEventsTable
16
16
 
17
17
  DEFAULT_SCOPES = [
18
- 'https://www.googleapis.com/auth/calendar',
19
- 'https://www.googleapis.com/auth/calendar.events',
20
- 'https://www.googleapis.com/auth/calendar.readonly'
18
+ "https://www.googleapis.com/auth/calendar",
19
+ "https://www.googleapis.com/auth/calendar.events",
20
+ "https://www.googleapis.com/auth/calendar.readonly",
21
21
  ]
22
22
 
23
23
  logger = log.getLogger(__name__)
@@ -25,12 +25,13 @@ logger = log.getLogger(__name__)
25
25
 
26
26
  class GoogleCalendarHandler(APIHandler):
27
27
  """
28
- A class for handling connections and interactions with the Google Calendar API.
28
+ A class for handling connections and interactions with the Google Calendar API.
29
29
  """
30
- name = 'google_calendar'
30
+
31
+ name = "google_calendar"
31
32
 
32
33
  def __init__(self, name: str, **kwargs):
33
- """ constructor
34
+ """constructor
34
35
  Args:
35
36
  name (str): the handler name
36
37
  credentials_file (str): The path to the credentials file.
@@ -39,32 +40,32 @@ class GoogleCalendarHandler(APIHandler):
39
40
  events (GoogleCalendarEventsTable): The `GoogleCalendarEventsTable` object for interacting with the events table.
40
41
  """
41
42
  super().__init__(name)
42
- self.connection_data = kwargs.get('connection_data', {})
43
+ self.connection_data = kwargs.get("connection_data", {})
43
44
 
44
45
  self.service = None
45
46
  self.is_connected = False
46
47
 
47
- self.handler_storage = kwargs['handler_storage']
48
+ self.handler_storage = kwargs["handler_storage"]
48
49
 
49
- self.credentials_url = self.connection_data.get('credentials_url', None)
50
- self.credentials_file = self.connection_data.get('credentials_file', None)
51
- if self.connection_data.get('credentials'):
52
- self.credentials_file = self.connection_data.pop('credentials')
50
+ self.credentials_url = self.connection_data.get("credentials_url", None)
51
+ self.credentials_file = self.connection_data.get("credentials_file", None)
52
+ if self.connection_data.get("credentials"):
53
+ self.credentials_file = self.connection_data.pop("credentials")
53
54
  if not self.credentials_file and not self.credentials_url:
54
55
  # try to get from config
55
- gcalendar_config = Config().get('handlers', {}).get('youtube', {})
56
- secret_file = gcalendar_config.get('credentials_file')
57
- secret_url = gcalendar_config.get('credentials_url')
56
+ gcalendar_config = Config().get("handlers", {}).get("youtube", {})
57
+ secret_file = gcalendar_config.get("credentials_file")
58
+ secret_url = gcalendar_config.get("credentials_url")
58
59
  if secret_file:
59
60
  self.credentials_file = secret_file
60
61
  elif secret_url:
61
62
  self.credentials_url = secret_url
62
63
 
63
- self.scopes = self.connection_data.get('scopes', DEFAULT_SCOPES)
64
+ self.scopes = self.connection_data.get("scopes", DEFAULT_SCOPES)
64
65
 
65
66
  events = GoogleCalendarEventsTable(self)
66
67
  self.events = events
67
- self._register_table('events', events)
68
+ self._register_table("events", events)
68
69
 
69
70
  def connect(self):
70
71
  """
@@ -77,10 +78,16 @@ class GoogleCalendarHandler(APIHandler):
77
78
  if self.is_connected is True:
78
79
  return self.service
79
80
 
80
- google_oauth2_manager = GoogleUserOAuth2Manager(self.handler_storage, self.scopes, self.credentials_file, self.credentials_url, self.connection_data.get('code'))
81
+ google_oauth2_manager = GoogleUserOAuth2Manager(
82
+ self.handler_storage,
83
+ self.scopes,
84
+ self.credentials_file,
85
+ self.credentials_url,
86
+ self.connection_data.get("code"),
87
+ )
81
88
  creds = google_oauth2_manager.get_oauth2_credentials()
82
89
 
83
- self.service = build('calendar', 'v3', credentials=creds)
90
+ self.service = build("calendar", "v3", credentials=creds)
84
91
  return self.service
85
92
 
86
93
  def check_connection(self) -> StatusResponse:
@@ -103,7 +110,7 @@ class GoogleCalendarHandler(APIHandler):
103
110
  return response
104
111
 
105
112
  except Exception as e:
106
- logger.error(f'Error connecting to Google Calendar API: {e}!')
113
+ logger.error(f"Error connecting to Google Calendar API: {e}!")
107
114
  response.error_message = e
108
115
 
109
116
  self.is_connected = response.success
@@ -114,7 +121,7 @@ class GoogleCalendarHandler(APIHandler):
114
121
  Receive raw query and act upon it somehow.
115
122
  Args:
116
123
  query (Any): query in native format (str for sql databases,
117
- dict for mongo, api's json etc)
124
+ api's json etc)
118
125
  Returns:
119
126
  HandlerResponse
120
127
  """
@@ -122,10 +129,7 @@ class GoogleCalendarHandler(APIHandler):
122
129
 
123
130
  df = self.call_application_api(method_name, params)
124
131
 
125
- return Response(
126
- RESPONSE_TYPE.TABLE,
127
- data_frame=df
128
- )
132
+ return Response(RESPONSE_TYPE.TABLE, data_frame=df)
129
133
 
130
134
  def get_events(self, params: dict = None) -> pd.DataFrame:
131
135
  """
@@ -139,12 +143,12 @@ class GoogleCalendarHandler(APIHandler):
139
143
  page_token = None
140
144
  events = pd.DataFrame(columns=self.events.get_columns())
141
145
  while True:
142
- events_result = service.events().list(calendarId='primary', pageToken=page_token, **params).execute()
146
+ events_result = service.events().list(calendarId="primary", pageToken=page_token, **params).execute()
143
147
  events = pd.concat(
144
- [events, pd.DataFrame(events_result.get('items', []), columns=self.events.get_columns())],
145
- ignore_index=True
148
+ [events, pd.DataFrame(events_result.get("items", []), columns=self.events.get_columns())],
149
+ ignore_index=True,
146
150
  )
147
- page_token = events_result.get('nextPageToken')
151
+ page_token = events_result.get("nextPageToken")
148
152
  if not page_token:
149
153
  break
150
154
  return events
@@ -159,37 +163,38 @@ class GoogleCalendarHandler(APIHandler):
159
163
  """
160
164
  service = self.connect()
161
165
  # Check if 'attendees' is a string and split it into a list
162
- if isinstance(params['attendees'], str):
163
- params['attendees'] = params['attendees'].split(',')
166
+ if isinstance(params["attendees"], str):
167
+ params["attendees"] = params["attendees"].split(",")
164
168
 
165
169
  event = {
166
- 'summary': params['summary'],
167
- 'location': params['location'],
168
- 'description': params['description'],
169
- 'start': {
170
- 'dateTime': params['start']['dateTime'],
171
- 'timeZone': params['start']['timeZone'],
170
+ "summary": params["summary"],
171
+ "location": params["location"],
172
+ "description": params["description"],
173
+ "start": {
174
+ "dateTime": params["start"]["dateTime"],
175
+ "timeZone": params["start"]["timeZone"],
172
176
  },
173
- 'end': {
174
- 'dateTime': params['end']['dateTime'],
175
- 'timeZone': params['end']['timeZone'],
177
+ "end": {
178
+ "dateTime": params["end"]["dateTime"],
179
+ "timeZone": params["end"]["timeZone"],
176
180
  },
177
- 'recurrence': [
178
- 'RRULE:FREQ=DAILY;COUNT=1'
181
+ "recurrence": ["RRULE:FREQ=DAILY;COUNT=1"],
182
+ "attendees": [
183
+ {"email": attendee["email"]}
184
+ for attendee in (
185
+ params["attendees"] if isinstance(params["attendees"], list) else [params["attendees"]]
186
+ )
179
187
  ],
180
- 'attendees': [{'email': attendee['email']} for attendee in (params['attendees']
181
- if isinstance(params['attendees'], list) else [params['attendees']])],
182
- 'reminders': {
183
- 'useDefault': False,
184
- 'overrides': [
185
- {'method': 'email', 'minutes': 24 * 60},
186
- {'method': 'popup', 'minutes': 10},
188
+ "reminders": {
189
+ "useDefault": False,
190
+ "overrides": [
191
+ {"method": "email", "minutes": 24 * 60},
192
+ {"method": "popup", "minutes": 10},
187
193
  ],
188
194
  },
189
195
  }
190
196
 
191
- event = service.events().insert(calendarId='primary',
192
- body=event).execute()
197
+ event = service.events().insert(calendarId="primary", body=event).execute()
193
198
  return pd.DataFrame([event], columns=self.events.get_columns())
194
199
 
195
200
  def update_event(self, params: dict = None) -> pd.DataFrame:
@@ -201,37 +206,38 @@ class GoogleCalendarHandler(APIHandler):
201
206
  DataFrame
202
207
  """
203
208
  service = self.connect()
204
- df = pd.DataFrame(columns=['eventId', 'status'])
205
- if params['event_id']:
206
- start_id = int(params['event_id'])
209
+ df = pd.DataFrame(columns=["eventId", "status"])
210
+ if params["event_id"]:
211
+ start_id = int(params["event_id"])
207
212
  end_id = start_id + 1
208
- elif not params['start_id']:
209
- start_id = int(params['end_id']) - 10
210
- elif not params['end_id']:
211
- end_id = int(params['start_id']) + 10
213
+ elif not params["start_id"]:
214
+ start_id = int(params["end_id"]) - 10
215
+ elif not params["end_id"]:
216
+ end_id = int(params["start_id"]) + 10
212
217
  else:
213
- start_id = int(params['start_id'])
214
- end_id = int(params['end_id'])
218
+ start_id = int(params["start_id"])
219
+ end_id = int(params["end_id"])
215
220
 
216
221
  for i in range(start_id, end_id):
217
- event = service.events().get(calendarId='primary', eventId=i).execute()
218
- if params['summary']:
219
- event['summary'] = params['summary']
220
- if params['location']:
221
- event['location'] = params['location']
222
- if params['description']:
223
- event['description'] = params['description']
224
- if params['start']:
225
- event['start']['dateTime'] = params['start']['dateTime']
226
- event['start']['timeZone'] = params['start']['timeZone']
227
- if params['end']:
228
- event['end']['dateTime'] = params['end']['dateTime']
229
- event['end']['timeZone'] = params['end']['timeZone']
230
- if params['attendees']:
231
- event['attendees'] = [{'email': attendee} for attendee in params['attendees'].split(',')]
232
- updated_event = service.events().update(calendarId='primary', eventId=event['id'], body=event).execute()
233
- df = pd.concat([df, pd.DataFrame([{'eventId': updated_event['id'], 'status': 'updated'}])],
234
- ignore_index=True)
222
+ event = service.events().get(calendarId="primary", eventId=i).execute()
223
+ if params["summary"]:
224
+ event["summary"] = params["summary"]
225
+ if params["location"]:
226
+ event["location"] = params["location"]
227
+ if params["description"]:
228
+ event["description"] = params["description"]
229
+ if params["start"]:
230
+ event["start"]["dateTime"] = params["start"]["dateTime"]
231
+ event["start"]["timeZone"] = params["start"]["timeZone"]
232
+ if params["end"]:
233
+ event["end"]["dateTime"] = params["end"]["dateTime"]
234
+ event["end"]["timeZone"] = params["end"]["timeZone"]
235
+ if params["attendees"]:
236
+ event["attendees"] = [{"email": attendee} for attendee in params["attendees"].split(",")]
237
+ updated_event = service.events().update(calendarId="primary", eventId=event["id"], body=event).execute()
238
+ df = pd.concat(
239
+ [df, pd.DataFrame([{"eventId": updated_event["id"], "status": "updated"}])], ignore_index=True
240
+ )
235
241
 
236
242
  return df
237
243
 
@@ -244,21 +250,21 @@ class GoogleCalendarHandler(APIHandler):
244
250
  DataFrame
245
251
  """
246
252
  service = self.connect()
247
- if params['event_id']:
248
- service.events().delete(calendarId='primary', eventId=params['event_id']).execute()
249
- return pd.DataFrame([{'eventId': params['event_id'], 'status': 'deleted'}])
253
+ if params["event_id"]:
254
+ service.events().delete(calendarId="primary", eventId=params["event_id"]).execute()
255
+ return pd.DataFrame([{"eventId": params["event_id"], "status": "deleted"}])
250
256
  else:
251
- df = pd.DataFrame(columns=['eventId', 'status'])
252
- if not params['start_id']:
253
- start_id = int(params['end_id']) - 10
254
- elif not params['end_id']:
255
- end_id = int(params['start_id']) + 10
257
+ df = pd.DataFrame(columns=["eventId", "status"])
258
+ if not params["start_id"]:
259
+ start_id = int(params["end_id"]) - 10
260
+ elif not params["end_id"]:
261
+ end_id = int(params["start_id"]) + 10
256
262
  else:
257
- start_id = int(params['start_id'])
258
- end_id = int(params['end_id'])
263
+ start_id = int(params["start_id"])
264
+ end_id = int(params["end_id"])
259
265
  for i in range(start_id, end_id):
260
- service.events().delete(calendarId='primary', eventId=str(i)).execute()
261
- df = pd.concat([df, pd.DataFrame([{'eventId': str(i), 'status': 'deleted'}])], ignore_index=True)
266
+ service.events().delete(calendarId="primary", eventId=str(i)).execute()
267
+ df = pd.concat([df, pd.DataFrame([{"eventId": str(i), "status": "deleted"}])], ignore_index=True)
262
268
  return df
263
269
 
264
270
  def call_application_api(self, method_name: str = None, params: dict = None) -> pd.DataFrame:
@@ -270,13 +276,13 @@ class GoogleCalendarHandler(APIHandler):
270
276
  Returns:
271
277
  DataFrame
272
278
  """
273
- if method_name == 'get_events':
279
+ if method_name == "get_events":
274
280
  return self.get_events(params)
275
- elif method_name == 'create_event':
281
+ elif method_name == "create_event":
276
282
  return self.create_event(params)
277
- elif method_name == 'update_event':
283
+ elif method_name == "update_event":
278
284
  return self.update_event(params)
279
- elif method_name == 'delete_event':
285
+ elif method_name == "delete_event":
280
286
  return self.delete_event(params)
281
287
  else:
282
- raise NotImplementedError(f'Unknown method {method_name}')
288
+ raise NotImplementedError(f"Unknown method {method_name}")