fast-agent-mcp 0.2.48__py3-none-any.whl → 0.2.50__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 fast-agent-mcp might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fast-agent-mcp
3
- Version: 0.2.48
3
+ Version: 0.2.50
4
4
  Summary: Define, Prompt and Test MCP enabled Agents and Workflows
5
5
  Author-email: Shaun Smith <fastagent@llmindset.co.uk>
6
6
  License: Apache License
@@ -208,8 +208,8 @@ License-File: LICENSE
208
208
  Classifier: License :: OSI Approved :: Apache Software License
209
209
  Classifier: Operating System :: OS Independent
210
210
  Classifier: Programming Language :: Python :: 3
211
- Requires-Python: >=3.12
212
- Requires-Dist: a2a-sdk>=0.2.9
211
+ Requires-Python: >=3.13
212
+ Requires-Dist: a2a-sdk>=0.3.0
213
213
  Requires-Dist: aiohttp>=3.11.13
214
214
  Requires-Dist: anthropic>=0.59.0
215
215
  Requires-Dist: azure-identity>=1.14.0
@@ -232,7 +232,7 @@ Requires-Dist: pydantic>=2.10.4
232
232
  Requires-Dist: pyperclip>=1.9.0
233
233
  Requires-Dist: pyyaml>=6.0.2
234
234
  Requires-Dist: rich>=14.1.0
235
- Requires-Dist: tensorzero>=2025.6.3
235
+ Requires-Dist: tensorzero>=2025.7.5
236
236
  Requires-Dist: typer>=0.15.1
237
237
  Provides-Extra: azure
238
238
  Requires-Dist: azure-identity>=1.14.0; extra == 'azure'
@@ -1,10 +1,10 @@
1
1
  mcp_agent/__init__.py,sha256=HWWxZeB-VxrUNNXZnu4duzKGwdfCdD2M_O6drN4kfs8,2389
2
2
  mcp_agent/app.py,sha256=3mtHP1nRQcRaKhhxgTmCOv00alh70nT7UxNA8bN47QE,5560
3
- mcp_agent/config.py,sha256=GBmdsNlW8YqL8Dp-6Ke4ufQkFuLiaUSq_b8mciQ6sOQ,19382
3
+ mcp_agent/config.py,sha256=uwfZIdnO4NpYF90uQjOvwhgh4GqYnVfkqCahhN5jZHc,19248
4
4
  mcp_agent/console.py,sha256=Gjf2QLFumwG1Lav__c07X_kZxxEUSkzV-1_-YbAwcwo,813
5
5
  mcp_agent/context.py,sha256=lzz_Fyf9lz9BBAUt1bRVBlyyHjLkyeuyIziAi4qXYUk,7639
6
6
  mcp_agent/context_dependent.py,sha256=QXfhw3RaQCKfscEEBRGuZ3sdMWqkgShz2jJ1ivGGX1I,1455
7
- mcp_agent/event_progress.py,sha256=d7T1hQ1D289MYh2Z5bMPB4JqjGqTOzveJuOHE03B_Xo,3720
7
+ mcp_agent/event_progress.py,sha256=EdozJ6a13Ur_zMMbPx-1pKwsLEbHF0bwCEcErhxLCew,4513
8
8
  mcp_agent/mcp_server_registry.py,sha256=lmz-aES-l7Gbg4itDF0iCmpso_KD8bVazVKSVzjwNE4,12398
9
9
  mcp_agent/progress_display.py,sha256=GeJU9VUt6qKsFVymG688hCMVCsAygG9ifiiEb5IcbN4,361
10
10
  mcp_agent/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -67,8 +67,8 @@ mcp_agent/llm/augmented_llm_playback.py,sha256=rLzgai496e2RlxqQp_Bp0U-Y1FF1SGsWl
67
67
  mcp_agent/llm/augmented_llm_silent.py,sha256=IUnK_1Byy4D9TG0Pj46LFeNezgSTQ8d6MQIHWAImBwE,1846
68
68
  mcp_agent/llm/augmented_llm_slow.py,sha256=DDSD8bL2flmQrVHZm-UDs7sR8aHRWkDOcOW-mX_GPok,2067
69
69
  mcp_agent/llm/memory.py,sha256=pTOaTDV3EA3X68yKwEtUAu7s0xGIQQ_cKBhfYUnfR0w,8614
70
- mcp_agent/llm/model_database.py,sha256=7puiFtc1tH25M5JEnKdAxsEk9OeAMJHamXA1c37tdjw,9490
71
- mcp_agent/llm/model_factory.py,sha256=2Ii81GrFJ9FvyjVb4OUyb0FRT59iAi9Vido5v0kZa7w,11732
70
+ mcp_agent/llm/model_database.py,sha256=7G_rAXRE2RFrly_2PRr5uji7fT0XqaWj_RwhpZVx1LU,10690
71
+ mcp_agent/llm/model_factory.py,sha256=WyuQm0hETOxECA9pjCm-Oo5Oh28186nsSWmjSntw2SE,11784
72
72
  mcp_agent/llm/prompt_utils.py,sha256=yWQHykoK13QRF7evHUKxVF0SpVLN-Bsft0Yixzvn0g0,4825
73
73
  mcp_agent/llm/provider_key_manager.py,sha256=LSWIgcXlrUS4sfBvQBCya82qC6NcXQPYLtDHwHNOXR4,3394
74
74
  mcp_agent/llm/provider_types.py,sha256=LfuVuFjcM_lMED0lkrNfKK8s8Fs1vbxugQsrcBE2CIY,1119
@@ -77,22 +77,22 @@ mcp_agent/llm/sampling_format_converter.py,sha256=xGz4odHpOcP7--eFaJaFtUR8eR9jxZ
77
77
  mcp_agent/llm/usage_tracking.py,sha256=rF6v8QQDam8QbvlP4jzHljKqvuNHExeYDLkUMI86czY,16073
78
78
  mcp_agent/llm/providers/__init__.py,sha256=heVxtmuqFJOnjjxHz4bWSqTAxXoN1E8twC_gQ_yJpHk,265
79
79
  mcp_agent/llm/providers/anthropic_utils.py,sha256=vYDN5G5jKMhD2CQg8veJYab7tvvzYkDMq8M1g_hUAQg,3275
80
- mcp_agent/llm/providers/augmented_llm_aliyun.py,sha256=TwqSQmRwnce_a904CSqsKWTzYRb-od8FFYlie2zwXcE,1101
80
+ mcp_agent/llm/providers/augmented_llm_aliyun.py,sha256=JlRfhohIQQlo5RgM1B2t4ITLC9dok8LQNKLf0BK8Ai8,1158
81
81
  mcp_agent/llm/providers/augmented_llm_anthropic.py,sha256=U8znA9HSCOx4FlhIjl-J29nbYc8Y-T6BXevtXuDafio,30352
82
- mcp_agent/llm/providers/augmented_llm_azure.py,sha256=sBVWgY88F4OsdRSHl71BAT2p3XPvuZp844z1ubwcV7U,6098
82
+ mcp_agent/llm/providers/augmented_llm_azure.py,sha256=Xoo6dFst6L9SaGKurqptwwTUzr-sYsolZ-AFb_79puc,6098
83
83
  mcp_agent/llm/providers/augmented_llm_bedrock.py,sha256=nfby1udL07zPTOLlN_tFxd1h0JRioo2oIW7v4iP4Bnk,82267
84
- mcp_agent/llm/providers/augmented_llm_deepseek.py,sha256=YokCz22qzbq5DyFCzviB8L7LwO1v3FAEt3UlB2EXWMI,3818
84
+ mcp_agent/llm/providers/augmented_llm_deepseek.py,sha256=vphkYMFyukaejBw8SkCN-MqcG9qsfXJfWKZYYtspqPY,3877
85
85
  mcp_agent/llm/providers/augmented_llm_generic.py,sha256=5Uq8ZBhcFuQTt7koP_5ykolREh2iWu8zKhNbh3pM9lQ,1210
86
86
  mcp_agent/llm/providers/augmented_llm_google_native.py,sha256=c6zczfs-Iw70j3OYELHJ4S7CRwAddkeXinex_yLMhmU,22194
87
87
  mcp_agent/llm/providers/augmented_llm_google_oai.py,sha256=g_g46h-YuxqbRZiO_dVo5zO2OkX1yx7nb6xDaQbOvWs,1137
88
- mcp_agent/llm/providers/augmented_llm_groq.py,sha256=MEk_1elggzIGlMIrnRP5bQ7kcBvu5jCwK0AoImkpb7c,1050
89
- mcp_agent/llm/providers/augmented_llm_openai.py,sha256=faleOhWV9ShJ3QW8VhaHOcQsRpYHU1W44eVk6uEcguA,24359
90
- mcp_agent/llm/providers/augmented_llm_openrouter.py,sha256=xKhEfjQEOnjMjbHT2Dc0ZD0_Cyx7EfFz1wA3Uh9S6Xk,2341
88
+ mcp_agent/llm/providers/augmented_llm_groq.py,sha256=5pqWgOoEJpvL230rJekBNlmBzUegbgwYitArlXgAmY0,4424
89
+ mcp_agent/llm/providers/augmented_llm_openai.py,sha256=veVi4NcIP5S7xiV5fZLCSRFSiQbU48xQye0z-xx7X8I,25183
90
+ mcp_agent/llm/providers/augmented_llm_openrouter.py,sha256=m3wS83fabBOmaZJH9gQ9sFw_2TB4xTb44WCOPB-2NJ4,2001
91
91
  mcp_agent/llm/providers/augmented_llm_tensorzero.py,sha256=wxNffqdM1Psvfyya6Pmo__BZjyrek55_8iTRoH4TboI,20577
92
- mcp_agent/llm/providers/augmented_llm_xai.py,sha256=PpztvX26mTl2GPTCzoI24ugxlm5BPpqByHnKO19ej28,1332
92
+ mcp_agent/llm/providers/augmented_llm_xai.py,sha256=MhlX91IUNynQ_NDknx4EQJLwg-NbR8lcHS1P4JuLOnA,1433
93
93
  mcp_agent/llm/providers/google_converter.py,sha256=xCUVw4W7lqBvJMgSKKdzW4Y00zmHBgCR6pOoWLYQQfw,16699
94
94
  mcp_agent/llm/providers/multipart_converter_anthropic.py,sha256=QsgIwWJ14SNZsun3fKDQaUx5AYdk8X6UYeBgYlZgZN0,16607
95
- mcp_agent/llm/providers/multipart_converter_openai.py,sha256=1zHlkMKY-16RL8qnrx7kI53IHmCiqASNvYsAdofSq_I,17000
95
+ mcp_agent/llm/providers/multipart_converter_openai.py,sha256=8vBwX7PB62mV6pe4VvAj9YxzX1Dp1RJMZK1NWOMnioY,17998
96
96
  mcp_agent/llm/providers/multipart_converter_tensorzero.py,sha256=Tr3DgogthxqTw04ajblwE8aB3Ft42X7aSXsMlm5FP4k,8619
97
97
  mcp_agent/llm/providers/openai_multipart.py,sha256=qKBn7d3jSabnJmVgWweVzqh8q9mBqr09fsPmP92niAQ,6899
98
98
  mcp_agent/llm/providers/openai_utils.py,sha256=T4bTCL9f7DsoS_zoKgQKv_FUv_4n98vgbvaUpdWZJr8,1875
@@ -103,7 +103,7 @@ mcp_agent/logging/events.py,sha256=dSJJfuCd59-ZyYTVcf0M4HQd6iXb5k50PSAeoq1CpH0,4
103
103
  mcp_agent/logging/json_serializer.py,sha256=qkfxnR9ka6OgvwSpM2CggELbEtzzkApm0s_KYz11RDY,5791
104
104
  mcp_agent/logging/listeners.py,sha256=_S4Jp5_KWp0kUfrx4BxDdNCeQK3MNT3Zi9AaolPri7A,6648
105
105
  mcp_agent/logging/logger.py,sha256=v2_D5kWLSS9u4ueSU7q6cWF1oSmTVeAAtgnwR0LrbXI,11056
106
- mcp_agent/logging/rich_progress.py,sha256=uMAKDPO8TlhT7uTeJzOEwQPme8pu8qCADLNbsI1vV8g,5544
106
+ mcp_agent/logging/rich_progress.py,sha256=_AMW_ODPs1RXmQ6aTu9je4hmwcCGi3lUmrVAhytq1C4,7462
107
107
  mcp_agent/logging/transport.py,sha256=_RVckOdcs_mXv6Jwz-MPe0vVTQEKsbejHdteyK5hBQA,16960
108
108
  mcp_agent/mcp/__init__.py,sha256=yxtzSmWBNqRf_nJckqgzYoozyGKja05FvSRLLus_7eM,1100
109
109
  mcp_agent/mcp/common.py,sha256=MpSC0fLO21RcDz4VApah4C8_LisVGz7OXkR17Xw-9mY,431
@@ -113,8 +113,8 @@ mcp_agent/mcp/gen_client.py,sha256=fAVwFVCgSamw4PwoWOV4wrK9TABx1S_zZv8BctRyF2k,3
113
113
  mcp_agent/mcp/hf_auth.py,sha256=7szw4rkwRyK3J-sUTcVZHdwoLIZqlYo8XolJnZdjOww,4571
114
114
  mcp_agent/mcp/interfaces.py,sha256=pe8WKvu3dnNnPWmrkDlu15xdkhuRDAjLUMn2vIE0Mj8,7963
115
115
  mcp_agent/mcp/logger_textio.py,sha256=vljC1BtNTCxBAda9ExqNB-FwVNUZIuJT3h1nWmCjMws,3172
116
- mcp_agent/mcp/mcp_agent_client_session.py,sha256=nEHrSalG5z47BKGwE9ooOmlSTc4Gb7qdEut071Dwepo,8987
117
- mcp_agent/mcp/mcp_aggregator.py,sha256=D1xFBVVq_4Tn1Ka16SZTVB3qeU-FO5501ITHGXTuXs0,49730
116
+ mcp_agent/mcp/mcp_agent_client_session.py,sha256=ssRgxMOzyCPyAr25AeRBz3Xr-08OBdmsJf8A-ofc3bY,9115
117
+ mcp_agent/mcp/mcp_aggregator.py,sha256=3L_UDxg7nz_Cp1hHVxxCrhDybxg-Bg2QH8e0F8x1_W4,51377
118
118
  mcp_agent/mcp/mcp_connection_manager.py,sha256=dJxjnv2IRzlFIxrbPFl39-pmGcZHgyeMXVlMfqpREhE,17974
119
119
  mcp_agent/mcp/mime_utils.py,sha256=difepNR_gpb4MpMLkBRAoyhDk-AjXUHTiqKvT_VwS1o,1805
120
120
  mcp_agent/mcp/prompt_message_multipart.py,sha256=XDlFODtOIepespQ23hvh37i3GF2L9Hju4AdNHijwe9k,4350
@@ -123,7 +123,7 @@ mcp_agent/mcp/prompt_serialization.py,sha256=MQY6QxnhQTiq0oBDsyRzFtX8sBiovUjzUFX
123
123
  mcp_agent/mcp/resource_utils.py,sha256=K4XY8bihmBMleRTZ2viMPiD2Y2HWxFnlgIJi6dd_PYE,6588
124
124
  mcp_agent/mcp/sampling.py,sha256=PpUtLDvu9K3U8445z6m_esHeKstdSr-JBTyn9d8ppJM,6665
125
125
  mcp_agent/mcp/helpers/__init__.py,sha256=jJP_yVlewL0hePTX_k_MAnUmOzxpr0Tr_rXYZYeE2WY,456
126
- mcp_agent/mcp/helpers/content_helpers.py,sha256=_P5xfVpJg4F7lBM-v6-1Bjtvfgr9UfTQoW2FSxyxil4,4112
126
+ mcp_agent/mcp/helpers/content_helpers.py,sha256=zrM0cUu9U-C9dRPszOZ6vxh0fquQhFODeDEXaC2TkBg,5173
127
127
  mcp_agent/mcp/helpers/server_config_helpers.py,sha256=MkyZB2ZzfsBNsqyGd0LfUOoXxhAMS28VF-f747cJJpY,978
128
128
  mcp_agent/mcp/prompts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
129
  mcp_agent/mcp/prompts/__main__.py,sha256=gr1Tdz9fcK0EXjEuZg_BOnKUmvhYq5AH2lFZicVyNb0,237
@@ -168,8 +168,8 @@ mcp_agent/resources/examples/workflows/short_story.txt,sha256=X3y_1AyhLFN2AKzCKv
168
168
  mcp_agent/tools/tool_definition.py,sha256=L3Pxl-uLEXqlVoo-bYuFTFALeI-2pIU44YgFhsTKEtM,398
169
169
  mcp_agent/ui/console_display.py,sha256=XXrHr950wSBSedEKUaaGkXjOzuFpQYzUKKiyaZ58Mps,28280
170
170
  mcp_agent/ui/console_display_legacy.py,sha256=sm2v61-IPVafbF7uUaOyhO2tW_zgFWOjNS83IEWqGgI,14931
171
- fast_agent_mcp-0.2.48.dist-info/METADATA,sha256=urEeemSyTBTUjlI5CtGjrqLD8SZWgYx1ph9GeUhp3J8,31048
172
- fast_agent_mcp-0.2.48.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
173
- fast_agent_mcp-0.2.48.dist-info/entry_points.txt,sha256=QaX5kLdI0VdMPRdPUF1nkG_WdLUTNjp_icW6e3EhNYU,232
174
- fast_agent_mcp-0.2.48.dist-info/licenses/LICENSE,sha256=Gx1L3axA4PnuK4FxsbX87jQ1opoOkSFfHHSytW6wLUU,10935
175
- fast_agent_mcp-0.2.48.dist-info/RECORD,,
171
+ fast_agent_mcp-0.2.50.dist-info/METADATA,sha256=jNGAWFccNjB_-7zrb8G6ambu93q8jtpvKxiA4Jp3rkQ,31048
172
+ fast_agent_mcp-0.2.50.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
173
+ fast_agent_mcp-0.2.50.dist-info/entry_points.txt,sha256=QaX5kLdI0VdMPRdPUF1nkG_WdLUTNjp_icW6e3EhNYU,232
174
+ fast_agent_mcp-0.2.50.dist-info/licenses/LICENSE,sha256=Gx1L3axA4PnuK4FxsbX87jQ1opoOkSFfHHSytW6wLUU,10935
175
+ fast_agent_mcp-0.2.50.dist-info/RECORD,,
mcp_agent/config.py CHANGED
@@ -8,6 +8,7 @@ import re
8
8
  from pathlib import Path
9
9
  from typing import Any, Dict, List, Literal, Optional, Tuple
10
10
 
11
+ from mcp import Implementation
11
12
  from pydantic import BaseModel, ConfigDict, field_validator
12
13
  from pydantic_settings import BaseSettings, SettingsConfigDict
13
14
 
@@ -61,11 +62,9 @@ class MCPServerSettings(BaseModel):
61
62
  Represents the configuration for an individual server.
62
63
  """
63
64
 
64
- # TODO: saqadri - server name should be something a server can provide itself during initialization
65
65
  name: str | None = None
66
66
  """The name of the server."""
67
67
 
68
- # TODO: saqadri - server description should be something a server can provide itself during initialization
69
68
  description: str | None = None
70
69
  """The description of the server."""
71
70
 
@@ -108,6 +107,8 @@ class MCPServerSettings(BaseModel):
108
107
  cwd: str | None = None
109
108
  """Working directory for the executed server command."""
110
109
 
110
+ implementation: Implementation | None = None
111
+
111
112
 
112
113
  class MCPSettings(BaseModel):
113
114
  """Configuration for all MCP servers."""
@@ -20,6 +20,7 @@ class ProgressAction(str, Enum):
20
20
  PLANNING = "Planning"
21
21
  READY = "Ready"
22
22
  CALLING_TOOL = "Calling Tool"
23
+ TOOL_PROGRESS = "Tool Progress"
23
24
  UPDATED = "Updated"
24
25
  FINISHED = "Finished"
25
26
  SHUTDOWN = "Shutdown"
@@ -35,6 +36,8 @@ class ProgressEvent(BaseModel):
35
36
  details: Optional[str] = None
36
37
  agent_name: Optional[str] = None
37
38
  streaming_tokens: Optional[str] = None # Special field for streaming token count
39
+ progress: Optional[float] = None # Current progress value
40
+ total: Optional[float] = None # Total value for progress calculation
38
41
 
39
42
  def __str__(self) -> str:
40
43
  """Format the progress event for display."""
@@ -86,6 +89,12 @@ def convert_log_event(event: Event) -> Optional[ProgressEvent]:
86
89
  details = f"{server_name} ({tool_name})"
87
90
  else:
88
91
  details = f"{server_name}"
92
+
93
+ # For TOOL_PROGRESS, use progress message if available, otherwise keep default
94
+ if progress_action == ProgressAction.TOOL_PROGRESS:
95
+ progress_message = event_data.get("details", "")
96
+ if progress_message: # Only override if message is non-empty
97
+ details = progress_message
89
98
 
90
99
  elif "augmented_llm" in namespace:
91
100
  model = event_data.get("model", "")
@@ -104,10 +113,19 @@ def convert_log_event(event: Event) -> Optional[ProgressEvent]:
104
113
  if progress_action == ProgressAction.STREAMING:
105
114
  streaming_tokens = event_data.get("details", "")
106
115
 
116
+ # Extract progress data for TOOL_PROGRESS actions
117
+ progress = None
118
+ total = None
119
+ if progress_action == ProgressAction.TOOL_PROGRESS:
120
+ progress = event_data.get("progress")
121
+ total = event_data.get("total")
122
+
107
123
  return ProgressEvent(
108
124
  action=ProgressAction(progress_action),
109
125
  target=target or "unknown",
110
126
  details=details,
111
127
  agent_name=event_data.get("agent_name"),
112
128
  streaming_tokens=streaming_tokens,
129
+ progress=progress,
130
+ total=total,
113
131
  )
@@ -22,6 +22,12 @@ class ModelParameters(BaseModel):
22
22
  tokenizes: List[str]
23
23
  """List of supported content types for tokenization"""
24
24
 
25
+ json_mode: None | str = "schema"
26
+ """Structured output style. 'schema', 'object' or None for unsupported """
27
+
28
+ reasoning: None | str = None
29
+ """Reasoning output style. 'tags' if enclosed in <thinking> tags, 'none' if not used"""
30
+
25
31
 
26
32
  class ModelDatabase:
27
33
  """Centralized model configuration database"""
@@ -87,6 +93,13 @@ class ModelDatabase:
87
93
  QWEN_STANDARD = ModelParameters(
88
94
  context_window=32000, max_output_tokens=8192, tokenizes=QWEN_MULTIMODAL
89
95
  )
96
+ QWEN3_REASONER = ModelParameters(
97
+ context_window=131072,
98
+ max_output_tokens=16384,
99
+ tokenizes=TEXT_ONLY,
100
+ json_mode="object",
101
+ reasoning="tags",
102
+ )
90
103
 
91
104
  FAST_AGENT_STANDARD = ModelParameters(
92
105
  context_window=1000000, max_output_tokens=100000, tokenizes=TEXT_ONLY
@@ -125,6 +138,13 @@ class ModelDatabase:
125
138
  context_window=65536, max_output_tokens=32768, tokenizes=TEXT_ONLY
126
139
  )
127
140
 
141
+ DEEPSEEK_DISTILL = ModelParameters(
142
+ context_window=131072,
143
+ max_output_tokens=131072,
144
+ tokenizes=TEXT_ONLY,
145
+ json_mode="object",
146
+ reasoning="tags",
147
+ )
128
148
  GEMINI_2_5_PRO = ModelParameters(
129
149
  context_window=2097152, max_output_tokens=8192, tokenizes=GOOGLE_MULTIMODAL
130
150
  )
@@ -214,6 +234,8 @@ class ModelDatabase:
214
234
  "grok-3-fast": GROK_3,
215
235
  "grok-3-mini-fast": GROK_3,
216
236
  "moonshotai/kimi-k2-instruct": KIMI_MOONSHOT,
237
+ "qwen/qwen3-32b": QWEN3_REASONER,
238
+ "deepseek-r1-distill-llama-70b": DEEPSEEK_DISTILL,
217
239
  }
218
240
 
219
241
  @classmethod
@@ -239,6 +261,18 @@ class ModelDatabase:
239
261
  params = cls.get_model_params(model)
240
262
  return params.tokenizes if params else None
241
263
 
264
+ @classmethod
265
+ def get_json_mode(cls, model: str) -> str | None:
266
+ """Get supported json mode (structured output) for a model"""
267
+ params = cls.get_model_params(model)
268
+ return params.json_mode if params else None
269
+
270
+ @classmethod
271
+ def get_reasoning(cls, model: str) -> str | None:
272
+ """Get supported reasoning output style for a model"""
273
+ params = cls.get_model_params(model)
274
+ return params.reasoning if params else None
275
+
242
276
  @classmethod
243
277
  def get_default_max_tokens(cls, model: str) -> int:
244
278
  """Get default max_tokens for RequestParams based on model"""
@@ -143,6 +143,7 @@ class ModelFactory:
143
143
  "gemini2": "gemini-2.0-flash",
144
144
  "gemini25": "gemini-2.5-flash-preview-05-20",
145
145
  "gemini25pro": "gemini-2.5-pro-preview-05-06",
146
+ "kimi": "groq.moonshotai/kimi-k2-instruct",
146
147
  }
147
148
 
148
149
  # Mapping of providers to their LLM classes
@@ -12,15 +12,14 @@ class AliyunAugmentedLLM(OpenAIAugmentedLLM):
12
12
 
13
13
  def _initialize_default_params(self, kwargs: dict) -> RequestParams:
14
14
  """Initialize Aliyun-specific default parameters"""
15
+ # Get base defaults from parent (includes ModelDatabase lookup)
16
+ base_params = super()._initialize_default_params(kwargs)
17
+
18
+ # Override with Aliyun-specific settings
15
19
  chosen_model = kwargs.get("model", DEFAULT_QWEN_MODEL)
16
-
17
- return RequestParams(
18
- model=chosen_model,
19
- systemPrompt=self.instruction,
20
- parallel_tool_calls=True,
21
- max_iterations=20,
22
- use_history=True,
23
- )
20
+ base_params.model = chosen_model
21
+
22
+ return base_params
24
23
 
25
24
  def _base_url(self) -> str:
26
25
  base_url = None
@@ -18,7 +18,7 @@ def _extract_resource_name(url: str) -> str | None:
18
18
  return host.replace(suffix, "") if host.endswith(suffix) else None
19
19
 
20
20
 
21
- DEFAULT_AZURE_API_VERSION = "2023-05-15"
21
+ DEFAULT_AZURE_API_VERSION = "2024-10-21"
22
22
 
23
23
 
24
24
  class AzureOpenAIAugmentedLLM(OpenAIAugmentedLLM):
@@ -22,15 +22,14 @@ class DeepSeekAugmentedLLM(OpenAIAugmentedLLM):
22
22
 
23
23
  def _initialize_default_params(self, kwargs: dict) -> RequestParams:
24
24
  """Initialize Deepseek-specific default parameters"""
25
+ # Get base defaults from parent (includes ModelDatabase lookup)
26
+ base_params = super()._initialize_default_params(kwargs)
27
+
28
+ # Override with Deepseek-specific settings
25
29
  chosen_model = kwargs.get("model", DEFAULT_DEEPSEEK_MODEL)
26
-
27
- return RequestParams(
28
- model=chosen_model,
29
- systemPrompt=self.instruction,
30
- parallel_tool_calls=True,
31
- max_iterations=20,
32
- use_history=True,
33
- )
30
+ base_params.model = chosen_model
31
+
32
+ return base_params
34
33
 
35
34
  def _base_url(self) -> str:
36
35
  base_url = None
@@ -1,9 +1,22 @@
1
+ from typing import List, Tuple, Type, cast
2
+
3
+ from pydantic_core import from_json
4
+
1
5
  from mcp_agent.core.request_params import RequestParams
6
+ from mcp_agent.llm.model_database import ModelDatabase
2
7
  from mcp_agent.llm.provider_types import Provider
3
8
  from mcp_agent.llm.providers.augmented_llm_openai import OpenAIAugmentedLLM
9
+ from mcp_agent.logging.logger import get_logger
10
+ from mcp_agent.mcp.helpers.content_helpers import get_text, split_thinking_content
11
+ from mcp_agent.mcp.interfaces import ModelT
12
+ from mcp_agent.mcp.prompt_message_multipart import PromptMessageMultipart
4
13
 
5
14
  GROQ_BASE_URL = "https://api.groq.com/openai/v1"
6
- DEFAULT_GROQ_MODEL = ""
15
+ DEFAULT_GROQ_MODEL = "moonshotai/kimi-k2-instruct"
16
+
17
+ ### There is some big refactorings to be had quite easily here now:
18
+ ### - combining the structured output type handling
19
+ ### - deduplicating between this and the deepseek llm
7
20
 
8
21
 
9
22
  class GroqAugmentedLLM(OpenAIAugmentedLLM):
@@ -12,15 +25,75 @@ class GroqAugmentedLLM(OpenAIAugmentedLLM):
12
25
 
13
26
  def _initialize_default_params(self, kwargs: dict) -> RequestParams:
14
27
  """Initialize Groq default parameters"""
28
+ # Get base defaults from parent (includes ModelDatabase lookup)
29
+ base_params = super()._initialize_default_params(kwargs)
30
+
31
+ # Override with Groq-specific settings
15
32
  chosen_model = kwargs.get("model", DEFAULT_GROQ_MODEL)
33
+ base_params.model = chosen_model
34
+ base_params.parallel_tool_calls = False
35
+
36
+ return base_params
37
+
38
+ async def _apply_prompt_provider_specific_structured(
39
+ self,
40
+ multipart_messages: List[PromptMessageMultipart],
41
+ model: Type[ModelT],
42
+ request_params: RequestParams | None = None,
43
+ ) -> Tuple[ModelT | None, PromptMessageMultipart]: # noqa: F821
44
+ request_params = self.get_request_params(request_params)
45
+
46
+ assert self.default_request_params
47
+ llm_model = self.default_request_params.model or DEFAULT_GROQ_MODEL
48
+ json_mode: str | None = ModelDatabase.get_json_mode(llm_model)
49
+ if "json_object" == json_mode:
50
+ request_params.response_format = {"type": "json_object"}
51
+
52
+ # Get the full schema and extract just the properties
53
+ full_schema = model.model_json_schema()
54
+ properties = full_schema.get("properties", {})
55
+ required_fields = full_schema.get("required", [])
56
+
57
+ # Create a cleaner format description
58
+ format_description = "{\n"
59
+ for field_name, field_info in properties.items():
60
+ field_type = field_info.get("type", "string")
61
+ description = field_info.get("description", "")
62
+ format_description += f' "{field_name}": "{field_type}"'
63
+ if description:
64
+ format_description += f" // {description}"
65
+ if field_name in required_fields:
66
+ format_description += " // REQUIRED"
67
+ format_description += "\n"
68
+ format_description += "}"
69
+
70
+ multipart_messages[-1].add_text(
71
+ f"""YOU MUST RESPOND WITH A JSON OBJECT IN EXACTLY THIS FORMAT:
72
+ {format_description}
73
+
74
+ IMPORTANT RULES:
75
+ - Respond ONLY with the JSON object, no other text
76
+ - Do NOT include "properties" or "schema" wrappers
77
+ - Do NOT use code fences or markdown
78
+ - The response must be valid JSON that matches the format above
79
+ - All required fields must be included"""
80
+ )
16
81
 
17
- return RequestParams(
18
- model=chosen_model,
19
- systemPrompt=self.instruction,
20
- parallel_tool_calls=False,
21
- max_iterations=20,
22
- use_history=True,
82
+ result: PromptMessageMultipart = await self._apply_prompt_provider_specific(
83
+ multipart_messages, request_params
23
84
  )
85
+ reasoning_mode: str | None = ModelDatabase.get_reasoning(llm_model)
86
+ try:
87
+ text = get_text(result.content[-1]) or ""
88
+ if "tags" == reasoning_mode:
89
+ _, text = split_thinking_content(text)
90
+ json_data = from_json(text, allow_partial=True)
91
+ validated_model = model.model_validate(json_data)
92
+ return cast("ModelT", validated_model), result
93
+ except ValueError as e:
94
+ logger = get_logger(__name__)
95
+ logger.warning(f"Failed to parse structured response: {str(e)}")
96
+ return None, result
24
97
 
25
98
  def _base_url(self) -> str:
26
99
  base_url = None
@@ -307,6 +307,7 @@ class OpenAIAugmentedLLM(AugmentedLLM[ChatCompletionMessageParam, ChatCompletion
307
307
  request_params = self.get_request_params(request_params=request_params)
308
308
 
309
309
  responses: List[ContentBlock] = []
310
+ model_name = self.default_request_params.model or DEFAULT_OPENAI_MODEL
310
311
 
311
312
  # TODO -- move this in to agent context management / agent group handling
312
313
  messages: List[ChatCompletionMessageParam] = []
@@ -347,7 +348,6 @@ class OpenAIAugmentedLLM(AugmentedLLM[ChatCompletionMessageParam, ChatCompletion
347
348
  stream = await self._openai_client().chat.completions.create(**arguments)
348
349
  # Process the stream
349
350
  response = await self._process_stream(stream, self.default_request_params.model)
350
-
351
351
  # Track usage if response is valid and has usage data
352
352
  if (
353
353
  hasattr(response, "usage")
@@ -391,6 +391,9 @@ class OpenAIAugmentedLLM(AugmentedLLM[ChatCompletionMessageParam, ChatCompletion
391
391
  # Convert to dict and remove None values
392
392
  message_dict = message.model_dump()
393
393
  message_dict = {k: v for k, v in message_dict.items() if v is not None}
394
+ if model_name == "deepseek-r1-distill-llama-70b":
395
+ message_dict.pop("reasoning", None)
396
+
394
397
  messages.append(message_dict)
395
398
 
396
399
  message_text = message.content
@@ -412,6 +415,7 @@ class OpenAIAugmentedLLM(AugmentedLLM[ChatCompletionMessageParam, ChatCompletion
412
415
  )
413
416
 
414
417
  tool_results = []
418
+
415
419
  for tool_call in message.tool_calls:
416
420
  self.show_tool_call(
417
421
  available_tools,
@@ -428,12 +432,24 @@ class OpenAIAugmentedLLM(AugmentedLLM[ChatCompletionMessageParam, ChatCompletion
428
432
  else from_json(tool_call.function.arguments, allow_partial=True),
429
433
  ),
430
434
  )
431
- result = await self.call_tool(tool_call_request, tool_call.id)
432
- self.show_tool_result(result)
433
435
 
434
- tool_results.append((tool_call.id, result))
435
- responses.extend(result.content)
436
- messages.extend(OpenAIConverter.convert_function_results_to_openai(tool_results))
436
+ try:
437
+ result = await self.call_tool(tool_call_request, tool_call.id)
438
+ self.show_tool_result(result)
439
+ tool_results.append((tool_call.id, result))
440
+ responses.extend(result.content)
441
+ except Exception as e:
442
+ self.logger.error(f"Tool call {tool_call.id} failed with error: {e}")
443
+ # Still add the tool_call_id with an error result to prevent missing responses
444
+ error_result = CallToolResult(
445
+ content=[TextContent(type="text", text=f"Tool call failed: {str(e)}")]
446
+ )
447
+ tool_results.append((tool_call.id, error_result))
448
+
449
+ converted_messages = OpenAIConverter.convert_function_results_to_openai(
450
+ tool_results
451
+ )
452
+ messages.extend(converted_messages)
437
453
 
438
454
  self.logger.debug(
439
455
  f"Iteration {i}: Tool call results: {str(tool_results) if tool_results else 'None'}"
@@ -17,24 +17,19 @@ class OpenRouterAugmentedLLM(OpenAIAugmentedLLM):
17
17
 
18
18
  def _initialize_default_params(self, kwargs: dict) -> RequestParams:
19
19
  """Initialize OpenRouter-specific default parameters."""
20
+ # Get base defaults from parent (includes ModelDatabase lookup)
21
+ base_params = super()._initialize_default_params(kwargs)
22
+
23
+ # Override with OpenRouter-specific settings
20
24
  # OpenRouter model names include the provider, e.g., "google/gemini-flash-1.5"
21
25
  # The model should be passed in the 'model' kwarg during factory creation.
22
26
  chosen_model = kwargs.get("model", DEFAULT_OPENROUTER_MODEL)
23
- if not chosen_model:
24
- # Unlike Deepseek, OpenRouter *requires* a model path in the identifier.
25
- # The factory should extract this before calling the constructor.
26
- # We rely on the model being passed correctly via kwargs.
27
- # If it's still None here, it indicates an issue upstream (factory or user input).
28
- # However, the base class _get_model handles the error if model is None.
29
- pass
30
-
31
- return RequestParams(
32
- model=chosen_model, # Will be validated by base class
33
- systemPrompt=self.instruction,
34
- parallel_tool_calls=True, # Default based on OpenAI provider
35
- max_iterations=20, # Default based on OpenAI provider
36
- use_history=True, # Default based on OpenAI provider
37
- )
27
+ if chosen_model:
28
+ base_params.model = chosen_model
29
+ # If it's still None here, it indicates an issue upstream (factory or user input).
30
+ # However, the base class _get_model handles the error if model is None.
31
+
32
+ return base_params
38
33
 
39
34
  def _base_url(self) -> str:
40
35
  """Retrieve the OpenRouter base URL from config or use the default."""
@@ -16,15 +16,15 @@ class XAIAugmentedLLM(OpenAIAugmentedLLM):
16
16
 
17
17
  def _initialize_default_params(self, kwargs: dict) -> RequestParams:
18
18
  """Initialize xAI parameters"""
19
+ # Get base defaults from parent (includes ModelDatabase lookup)
20
+ base_params = super()._initialize_default_params(kwargs)
21
+
22
+ # Override with xAI-specific settings
19
23
  chosen_model = kwargs.get("model", DEFAULT_XAI_MODEL)
20
-
21
- return RequestParams(
22
- model=chosen_model,
23
- systemPrompt=self.instruction,
24
- parallel_tool_calls=False,
25
- max_iterations=20,
26
- use_history=True,
27
- )
24
+ base_params.model = chosen_model
25
+ base_params.parallel_tool_calls = False
26
+
27
+ return base_params
28
28
 
29
29
  def _base_url(self) -> str:
30
30
  base_url = os.getenv("XAI_BASE_URL", XAI_BASE_URL)
@@ -441,9 +441,6 @@ class OpenAIConverter:
441
441
  # Convert to OpenAI format
442
442
  user_message = OpenAIConverter.convert_to_openai(non_text_multipart)
443
443
 
444
- # We need to add tool_call_id manually
445
- user_message["tool_call_id"] = tool_call_id
446
-
447
444
  return (tool_message, [user_message])
448
445
 
449
446
  @staticmethod
@@ -461,22 +458,42 @@ class OpenAIConverter:
461
458
  Returns:
462
459
  List of OpenAI API messages for tool responses
463
460
  """
464
- messages = []
461
+ tool_messages = []
462
+ user_messages = []
463
+ has_mixed_content = False
465
464
 
466
465
  for tool_call_id, result in results:
467
- converted = OpenAIConverter.convert_tool_result_to_openai(
468
- tool_result=result,
469
- tool_call_id=tool_call_id,
470
- concatenate_text_blocks=concatenate_text_blocks,
471
- )
472
-
473
- # Handle the case where we have mixed content and get back a tuple
474
- if isinstance(converted, tuple):
475
- tool_message, additional_messages = converted
476
- messages.append(tool_message)
477
- messages.extend(additional_messages)
478
- else:
479
- # Single message case (text-only)
480
- messages.append(converted)
466
+ try:
467
+ converted = OpenAIConverter.convert_tool_result_to_openai(
468
+ tool_result=result,
469
+ tool_call_id=tool_call_id,
470
+ concatenate_text_blocks=concatenate_text_blocks,
471
+ )
481
472
 
473
+ # Handle the case where we have mixed content and get back a tuple
474
+ if isinstance(converted, tuple):
475
+ tool_message, additional_messages = converted
476
+ tool_messages.append(tool_message)
477
+ user_messages.extend(additional_messages)
478
+ has_mixed_content = True
479
+ else:
480
+ # Single message case (text-only)
481
+ tool_messages.append(converted)
482
+ except Exception as e:
483
+ _logger.error(f"Failed to convert tool_call_id={tool_call_id}: {e}")
484
+ # Create a basic tool response to prevent missing tool_call_id error
485
+ fallback_message = {
486
+ "role": "tool",
487
+ "tool_call_id": tool_call_id,
488
+ "content": f"[Conversion error: {str(e)}]",
489
+ }
490
+ tool_messages.append(fallback_message)
491
+
492
+ # CONDITIONAL REORDERING: Only reorder if there are user messages (mixed content)
493
+ if has_mixed_content and user_messages:
494
+ # Reorder: All tool messages first (OpenAI sequence), then user messages (vision context)
495
+ messages = tool_messages + user_messages
496
+ else:
497
+ # Pure tool responses - keep original order to preserve context (snapshots, etc.)
498
+ messages = tool_messages
482
499
  return messages
@@ -21,7 +21,7 @@ class RichProgressDisplay:
21
21
  self._progress = Progress(
22
22
  SpinnerColumn(spinner_name="simpleDotsScrolling"),
23
23
  TextColumn(
24
- "[progress.description]{task.description}|",
24
+ "[progress.description]{task.description}",
25
25
  # table_column=Column(max_width=16),
26
26
  ),
27
27
  TextColumn(text_format="{task.fields[target]:<16}", style="Bold Blue"),
@@ -77,11 +77,12 @@ class RichProgressDisplay:
77
77
  ProgressAction.LOADED: "dim green",
78
78
  ProgressAction.INITIALIZED: "dim green",
79
79
  ProgressAction.CHATTING: "bold blue",
80
- ProgressAction.STREAMING: "bold blue", # Same color as chatting
80
+ ProgressAction.STREAMING: "bold green", # Assistant Colour
81
81
  ProgressAction.ROUTING: "bold blue",
82
82
  ProgressAction.PLANNING: "bold blue",
83
83
  ProgressAction.READY: "dim green",
84
84
  ProgressAction.CALLING_TOOL: "bold magenta",
85
+ ProgressAction.TOOL_PROGRESS: "bold magenta",
85
86
  ProgressAction.FINISHED: "black on green",
86
87
  ProgressAction.SHUTDOWN: "black on red",
87
88
  ProgressAction.AGGREGATOR_INITIALIZED: "bold green",
@@ -107,18 +108,49 @@ class RichProgressDisplay:
107
108
  # Ensure no None values in the update
108
109
  # For streaming, use custom description immediately to avoid flashing
109
110
  if event.action == ProgressAction.STREAMING and event.streaming_tokens:
110
- formatted_tokens = f"↓ {event.streaming_tokens.strip()}".ljust(15)
111
+ # Account for [dim][/dim] tags (11 characters) in padding calculation
112
+ formatted_tokens = f"▎[dim]◀[/dim] {event.streaming_tokens.strip()}".ljust(17 + 11)
111
113
  description = f"[{self._get_action_style(event.action)}]{formatted_tokens}"
114
+ elif event.action == ProgressAction.CHATTING:
115
+ # Add special formatting for chatting with dimmed arrow
116
+ formatted_text = f"▎[dim]▶[/dim] {event.action.value.strip()}".ljust(17 + 11)
117
+ description = f"[{self._get_action_style(event.action)}]{formatted_text}"
118
+ elif event.action == ProgressAction.CALLING_TOOL:
119
+ # Add special formatting for calling tool with dimmed arrow
120
+ formatted_text = f"▎[dim]◀[/dim] {event.action.value}".ljust(17 + 11)
121
+ description = f"[{self._get_action_style(event.action)}]{formatted_text}"
122
+ elif event.action == ProgressAction.TOOL_PROGRESS:
123
+ # Format similar to streaming - show progress numbers
124
+ if event.progress is not None:
125
+ if event.total is not None:
126
+ progress_display = f"{int(event.progress)}/{int(event.total)}"
127
+ else:
128
+ progress_display = str(int(event.progress))
129
+ else:
130
+ progress_display = "Processing"
131
+ formatted_text = f"▎[dim]▶[/dim] {progress_display}".ljust(17 + 11)
132
+ description = f"[{self._get_action_style(event.action)}]{formatted_text}"
112
133
  else:
113
- description = f"[{self._get_action_style(event.action)}]{event.action.value:<15}"
114
-
115
- self._progress.update(
116
- task_id,
117
- description=description,
118
- target=event.target or task_name, # Use task_name as fallback for target
119
- details=event.details or "",
120
- task_name=task_name,
121
- )
134
+ description = f"[{self._get_action_style(event.action)}]{event.action.value:<15}"
135
+
136
+ # Update basic task information
137
+ update_kwargs = {
138
+ "description": description,
139
+ "target": event.target or task_name, # Use task_name as fallback for target
140
+ "details": event.details or "",
141
+ "task_name": task_name,
142
+ }
143
+
144
+ # For TOOL_PROGRESS events, update progress if available
145
+ if event.action == ProgressAction.TOOL_PROGRESS and event.progress is not None:
146
+ if event.total is not None:
147
+ update_kwargs["completed"] = event.progress
148
+ update_kwargs["total"] = event.total
149
+ else:
150
+ # If no total, just show as indeterminate progress
151
+ self._progress.reset(task_id)
152
+
153
+ self._progress.update(task_id, **update_kwargs)
122
154
 
123
155
  if (
124
156
  event.action == ProgressAction.INITIALIZED
@@ -156,3 +156,32 @@ def get_resource_text(result: ReadResourceResult, index: int = 0) -> Optional[st
156
156
  return content.text
157
157
 
158
158
  return None
159
+
160
+
161
+ def split_thinking_content(message: str) -> tuple[Optional[str], str]:
162
+ """
163
+ Split a message into thinking and content parts.
164
+
165
+ Extracts content between <thinking> tags and returns it along with the remaining content.
166
+
167
+ Args:
168
+ message: A string that may contain a <thinking>...</thinking> block followed by content
169
+
170
+ Returns:
171
+ A tuple of (thinking_content, main_content) where:
172
+ - thinking_content: The content inside <thinking> tags, or None if not found/parsing fails
173
+ - main_content: The content after the thinking block, or the entire message if no thinking block
174
+ """
175
+ import re
176
+
177
+ # Pattern to match <thinking>...</thinking> at the start of the message
178
+ pattern = r"^<think>(.*?)</think>\s*(.*)$"
179
+ match = re.match(pattern, message, re.DOTALL)
180
+
181
+ if match:
182
+ thinking_content = match.group(1).strip()
183
+ main_content = match.group(2).strip()
184
+ return (thinking_content, main_content)
185
+ else:
186
+ # No thinking block found or parsing failed
187
+ return (None, message)
@@ -66,9 +66,6 @@ class MCPAgentClientSession(ClientSession, ContextDependent):
66
66
  # Extract server_name if provided in kwargs
67
67
  from importlib.metadata import version
68
68
 
69
- version = version("fast-agent-mcp") or "dev"
70
- fast_agent: Implementation = Implementation(name="fast-agent-mcp", version=version)
71
-
72
69
  self.session_server_name = kwargs.pop("server_name", None)
73
70
  # Extract the notification callbacks if provided
74
71
  self._tool_list_changed_callback = kwargs.pop("tool_list_changed_callback", None)
@@ -83,6 +80,11 @@ class MCPAgentClientSession(ClientSession, ContextDependent):
83
80
  # Extract custom elicitation handler if provided
84
81
  custom_elicitation_handler = kwargs.pop("elicitation_handler", None)
85
82
 
83
+ version = version("fast-agent-mcp") or "dev"
84
+ fast_agent: Implementation = Implementation(name="fast-agent-mcp", version=version)
85
+ if self.server_config and self.server_config.implementation:
86
+ fast_agent = self.server_config.implementation
87
+
86
88
  # Only register callbacks if the server_config has the relevant settings
87
89
  list_roots_cb = list_roots if (self.server_config and self.server_config.roots) else None
88
90
 
@@ -12,6 +12,7 @@ from typing import (
12
12
 
13
13
  from mcp import GetPromptResult, ReadResourceResult
14
14
  from mcp.client.session import ClientSession
15
+ from mcp.shared.session import ProgressFnT
15
16
  from mcp.types import (
16
17
  CallToolResult,
17
18
  ListToolsResult,
@@ -136,6 +137,24 @@ class MCPAggregator(ContextDependent):
136
137
  # Lock for refreshing tools from a server
137
138
  self._refresh_lock = Lock()
138
139
 
140
+ def _create_progress_callback(self, server_name: str, tool_name: str) -> "ProgressFnT":
141
+ """Create a progress callback function for tool execution."""
142
+ async def progress_callback(progress: float, total: float | None, message: str | None) -> None:
143
+ """Handle progress notifications from MCP tool execution."""
144
+ logger.info(
145
+ "Tool progress update",
146
+ data={
147
+ "progress_action": ProgressAction.TOOL_PROGRESS,
148
+ "tool_name": tool_name,
149
+ "server_name": server_name,
150
+ "agent_name": self.agent_name,
151
+ "progress": progress,
152
+ "total": total,
153
+ "details": message or "", # Put the message in details column
154
+ },
155
+ )
156
+ return progress_callback
157
+
139
158
  async def close(self) -> None:
140
159
  """
141
160
  Close all persistent connections when the aggregator is deleted.
@@ -468,6 +487,7 @@ class MCPAggregator(ContextDependent):
468
487
  method_name: str,
469
488
  method_args: Dict[str, Any] = None,
470
489
  error_factory: Callable[[str], R] = None,
490
+ progress_callback: ProgressFnT | None = None,
471
491
  ) -> R:
472
492
  """
473
493
  Generic method to execute operations on a specific server.
@@ -479,6 +499,7 @@ class MCPAggregator(ContextDependent):
479
499
  method_name: Name of the method to call on the client session
480
500
  method_args: Arguments to pass to the method
481
501
  error_factory: Function to create an error return value if the operation fails
502
+ progress_callback: Optional progress callback for operations that support it
482
503
 
483
504
  Returns:
484
505
  Result from the operation or an error result
@@ -487,7 +508,12 @@ class MCPAggregator(ContextDependent):
487
508
  async def try_execute(client: ClientSession):
488
509
  try:
489
510
  method = getattr(client, method_name)
490
- return await method(**method_args)
511
+ # For call_tool method, check if we need to add progress_callback
512
+ if method_name == "call_tool" and progress_callback:
513
+ # The call_tool method signature includes progress_callback parameter
514
+ return await method(**method_args, progress_callback=progress_callback)
515
+ else:
516
+ return await method(**method_args)
491
517
  except Exception as e:
492
518
  error_msg = (
493
519
  f"Failed to {method_name} '{operation_name}' on server '{server_name}': {e}"
@@ -597,6 +623,10 @@ class MCPAggregator(ContextDependent):
597
623
  with tracer.start_as_current_span(f"MCP Tool: {server_name}/{local_tool_name}"):
598
624
  trace.get_current_span().set_attribute("tool_name", local_tool_name)
599
625
  trace.get_current_span().set_attribute("server_name", server_name)
626
+
627
+ # Create progress callback for this tool execution
628
+ progress_callback = self._create_progress_callback(server_name, local_tool_name)
629
+
600
630
  return await self._execute_on_server(
601
631
  server_name=server_name,
602
632
  operation_type="tool",
@@ -609,6 +639,7 @@ class MCPAggregator(ContextDependent):
609
639
  error_factory=lambda msg: CallToolResult(
610
640
  isError=True, content=[TextContent(type="text", text=msg)]
611
641
  ),
642
+ progress_callback=progress_callback,
612
643
  )
613
644
 
614
645
  async def get_prompt(