fast-agent-mcp 0.2.41__py3-none-any.whl → 0.2.43__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.41
3
+ Version: 0.2.43
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
@@ -213,6 +213,7 @@ Requires-Dist: a2a-sdk>=0.2.9
213
213
  Requires-Dist: aiohttp>=3.11.13
214
214
  Requires-Dist: anthropic>=0.55.0
215
215
  Requires-Dist: azure-identity>=1.14.0
216
+ Requires-Dist: boto3>=1.35.0
216
217
  Requires-Dist: deprecated>=1.2.18
217
218
  Requires-Dist: email-validator>=2.2.0
218
219
  Requires-Dist: fastapi>=0.115.6
@@ -1,6 +1,6 @@
1
1
  mcp_agent/__init__.py,sha256=18T0AG0W9sJhTY38O9GFFOzliDhxx9p87CvRyti9zbw,1620
2
2
  mcp_agent/app.py,sha256=3mtHP1nRQcRaKhhxgTmCOv00alh70nT7UxNA8bN47QE,5560
3
- mcp_agent/config.py,sha256=3XjoGlBzL7nItt6oxzsJb1pEKXWB-bHkdkc8F0hDX7o,18394
3
+ mcp_agent/config.py,sha256=ORid5f2YSkkNHIWHFgIWdcqyqr3g1TGV5ZTQMinuMi0,18869
4
4
  mcp_agent/console.py,sha256=Gjf2QLFumwG1Lav__c07X_kZxxEUSkzV-1_-YbAwcwo,813
5
5
  mcp_agent/context.py,sha256=9s1F1-UfcI8rz9Yxm6EXHZ4cInuE_cOl_HFu8N8k3yc,7497
6
6
  mcp_agent/context_dependent.py,sha256=QXfhw3RaQCKfscEEBRGuZ3sdMWqkgShz2jJ1ivGGX1I,1455
@@ -9,7 +9,7 @@ mcp_agent/mcp_server_registry.py,sha256=lmz-aES-l7Gbg4itDF0iCmpso_KD8bVazVKSVzjw
9
9
  mcp_agent/progress_display.py,sha256=GeJU9VUt6qKsFVymG688hCMVCsAygG9ifiiEb5IcbN4,361
10
10
  mcp_agent/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  mcp_agent/agents/agent.py,sha256=EAYlcP1qqI1D0_CS808I806z1048FBjZQxxpcCZPeIU,3154
12
- mcp_agent/agents/base_agent.py,sha256=240FsLvgsjj_exhsj37WIBxEGEyuBuM8mx9d30T26zs,25841
12
+ mcp_agent/agents/base_agent.py,sha256=EpdwZKktelEVdQUYyMoohtVwGgwas-rdM9r1nuMQIQk,30597
13
13
  mcp_agent/agents/workflow/__init__.py,sha256=HloteEW6kalvgR0XewpiFAqaQlMPlPJYg5p3K33IUzI,25
14
14
  mcp_agent/agents/workflow/chain_agent.py,sha256=eIlImirrSXkqBJmPuAJgOKis81Cl6lZEGM0-6IyaUV8,6105
15
15
  mcp_agent/agents/workflow/evaluator_optimizer.py,sha256=ysUMGM2NzeCIutgr_vXH6kUPpZMw0cX4J_Wl1r8eT84,13296
@@ -31,10 +31,10 @@ mcp_agent/cli/commands/setup.py,sha256=eOEd4TL-b0DaDeSJMGOfNOsTEItoZ67W88eTP4aP-
31
31
  mcp_agent/cli/commands/url_parser.py,sha256=5VdtcHRHzi67YignStVbz7u-rcvNNErw9oJLAUFOtEY,5855
32
32
  mcp_agent/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  mcp_agent/core/agent_app.py,sha256=mMWfScEylf1l-rKzmRdoA7WIIBRvSypfZONDBYdo1M8,15919
34
- mcp_agent/core/agent_types.py,sha256=LbSXolCIqXDt7p7AGCNO0MykgobT2IFjPy3jDEEJClk,1536
35
- mcp_agent/core/direct_decorators.py,sha256=VutR9hO2dkWIWMRHXmPUeW2ZpfSZVOW2NaiVTcWEa3c,17824
34
+ mcp_agent/core/agent_types.py,sha256=7zVzAFWjvh5dDV3TuDwmO9LAWmDjYnZd3eeLH-wvvIQ,1705
35
+ mcp_agent/core/direct_decorators.py,sha256=sYoEA1EmdyAxTpQwUDUjQYWY73VviM-fBnV1Zv7KfeU,19047
36
36
  mcp_agent/core/direct_factory.py,sha256=d_HvbAxyv2WrM07zyCpLXFVn7eArXk1LZmLKS49hzJo,19537
37
- mcp_agent/core/enhanced_prompt.py,sha256=3TBSwDUBE_dRd46sZnDvuInptdF9MU2sYwCNbr2QY4E,32769
37
+ mcp_agent/core/enhanced_prompt.py,sha256=jrAINowXPqXWGrk_g6xcvMXFE0SEBetNdDtV25vnCBU,33411
38
38
  mcp_agent/core/error_handling.py,sha256=xoyS2kLe0eG0bj2eSJCJ2odIhGUve2SbDR7jP-A-uRw,624
39
39
  mcp_agent/core/exceptions.py,sha256=ENAD_qGG67foxy6vDkIvc-lgopIUQy6O7zvNPpPXaQg,2289
40
40
  mcp_agent/core/fastagent.py,sha256=tAxapB3sjNyK6FqsJdOZt-IN5uYAi8DL1B9RHcGu55g,24849
@@ -63,10 +63,10 @@ mcp_agent/llm/augmented_llm_silent.py,sha256=IUnK_1Byy4D9TG0Pj46LFeNezgSTQ8d6MQI
63
63
  mcp_agent/llm/augmented_llm_slow.py,sha256=DDSD8bL2flmQrVHZm-UDs7sR8aHRWkDOcOW-mX_GPok,2067
64
64
  mcp_agent/llm/memory.py,sha256=pTOaTDV3EA3X68yKwEtUAu7s0xGIQQ_cKBhfYUnfR0w,8614
65
65
  mcp_agent/llm/model_database.py,sha256=YgqltGMDcmuoVrx-jiRj7Z5NCzKz2bshk7Rgkng2tsM,9401
66
- mcp_agent/llm/model_factory.py,sha256=NY9FQJZ9oLnFNyt8RjSQha9dlCEUKDsCP76H73dBl3s,11225
66
+ mcp_agent/llm/model_factory.py,sha256=Vr7Ypt2laE_gPPdLWOFAQSXZkD7p3D5KKSvH3ijDwWw,11616
67
67
  mcp_agent/llm/prompt_utils.py,sha256=yWQHykoK13QRF7evHUKxVF0SpVLN-Bsft0Yixzvn0g0,4825
68
68
  mcp_agent/llm/provider_key_manager.py,sha256=LSWIgcXlrUS4sfBvQBCya82qC6NcXQPYLtDHwHNOXR4,3394
69
- mcp_agent/llm/provider_types.py,sha256=pY67LJGhaUv0VtkgyWo8l0Lpia10JhQo0aML8-2-B3M,1054
69
+ mcp_agent/llm/provider_types.py,sha256=XK9IwmJND7Gd-WvggRXKovBSV9tTwtLD2BSUs86epp4,1091
70
70
  mcp_agent/llm/sampling_converter.py,sha256=C7wPBlmT0eD90XWabC22zkxsrVHKCrjwIwg6cG628cI,2926
71
71
  mcp_agent/llm/sampling_format_converter.py,sha256=xGz4odHpOcP7--eFaJaFtUR8eR9jxZS7MnLH6J7n0EU,1263
72
72
  mcp_agent/llm/usage_tracking.py,sha256=rF6v8QQDam8QbvlP4jzHljKqvuNHExeYDLkUMI86czY,16073
@@ -75,11 +75,12 @@ mcp_agent/llm/providers/anthropic_utils.py,sha256=vYDN5G5jKMhD2CQg8veJYab7tvvzYk
75
75
  mcp_agent/llm/providers/augmented_llm_aliyun.py,sha256=XylkJKZ9theSVUxJKOZkf1244hgzng4Ng4Dr209Qb-w,1101
76
76
  mcp_agent/llm/providers/augmented_llm_anthropic.py,sha256=dKXP8d36jzqThV8E404PUYbTuQbRz9x7uQScW4_BU6U,24060
77
77
  mcp_agent/llm/providers/augmented_llm_azure.py,sha256=sBVWgY88F4OsdRSHl71BAT2p3XPvuZp844z1ubwcV7U,6098
78
+ mcp_agent/llm/providers/augmented_llm_bedrock.py,sha256=tcbMovzA4W1JMB-PrvxXlwea8if-tmYooq9ME2W6Leo,82327
78
79
  mcp_agent/llm/providers/augmented_llm_deepseek.py,sha256=zI9a90dwT4r6E1f_xp4K50Cj9sD7y7kNRgjo0s1pd5w,3804
79
80
  mcp_agent/llm/providers/augmented_llm_generic.py,sha256=5Uq8ZBhcFuQTt7koP_5ykolREh2iWu8zKhNbh3pM9lQ,1210
80
81
  mcp_agent/llm/providers/augmented_llm_google_native.py,sha256=meWvjiNny2T8Map_TuLl8gx9JX8Ly8orHMFUCx3gtFU,22389
81
82
  mcp_agent/llm/providers/augmented_llm_google_oai.py,sha256=cO4dvjTl9ymqEurCOo5nP09ATfXVjgkuk1yZAlWpS1s,1137
82
- mcp_agent/llm/providers/augmented_llm_openai.py,sha256=R3w_XPg9hegcq-bM-W2HKivEPVJPvr5ipYKr-4mJeDQ,24264
83
+ mcp_agent/llm/providers/augmented_llm_openai.py,sha256=AP2ZXZhFXntZlhm50Bi2QwLfTybIX134Y6e_OktdhG8,24321
83
84
  mcp_agent/llm/providers/augmented_llm_openrouter.py,sha256=V_TlVKm92GHBxYIo6gpvH_6cAaIdppS25Tz6x5T7LW0,2341
84
85
  mcp_agent/llm/providers/augmented_llm_tensorzero.py,sha256=Mol_Wzj_ZtccW-LMw0oFwWUt1m1yfofloay9QYNP23c,20729
85
86
  mcp_agent/llm/providers/augmented_llm_xai.py,sha256=fJiO9Vkgi32pEMijxMbqoKrPCCNJmR_3YEnX0UCqOVs,1332
@@ -95,7 +96,7 @@ mcp_agent/logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
95
96
  mcp_agent/logging/events.py,sha256=dSJJfuCd59-ZyYTVcf0M4HQd6iXb5k50PSAeoq1CpH0,4278
96
97
  mcp_agent/logging/json_serializer.py,sha256=qkfxnR9ka6OgvwSpM2CggELbEtzzkApm0s_KYz11RDY,5791
97
98
  mcp_agent/logging/listeners.py,sha256=_S4Jp5_KWp0kUfrx4BxDdNCeQK3MNT3Zi9AaolPri7A,6648
98
- mcp_agent/logging/logger.py,sha256=l02OGX_c5FOyH0rspd4ZvnkJcbb0FahhUhlh2KI8mqE,10724
99
+ mcp_agent/logging/logger.py,sha256=v2_D5kWLSS9u4ueSU7q6cWF1oSmTVeAAtgnwR0LrbXI,11056
99
100
  mcp_agent/logging/rich_progress.py,sha256=NQbW010VxfzgJw8BRaqKVTIFlTNvDfmMcoOt7pxGvzQ,5362
100
101
  mcp_agent/logging/transport.py,sha256=m8YsLLu5T8eof_ndpLQs4gHOzqqEL98xsVwBwDsBfxI,17335
101
102
  mcp_agent/mcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -103,11 +104,11 @@ mcp_agent/mcp/common.py,sha256=MpSC0fLO21RcDz4VApah4C8_LisVGz7OXkR17Xw-9mY,431
103
104
  mcp_agent/mcp/elicitation_factory.py,sha256=gY0gEsF8Jdg01nSsrVbbl62ZS1A725QgDRB6UDPCadc,3162
104
105
  mcp_agent/mcp/elicitation_handlers.py,sha256=w2S4kBn05pIKdq2-X13MErinFg5jSElwFsoTuW3zFSs,6618
105
106
  mcp_agent/mcp/gen_client.py,sha256=fAVwFVCgSamw4PwoWOV4wrK9TABx1S_zZv8BctRyF2k,3030
106
- mcp_agent/mcp/hf_auth.py,sha256=YwEt7hMDJODFUIc6Zi1HLYsfVnvANGvyhpQwcPCMAgI,3379
107
+ mcp_agent/mcp/hf_auth.py,sha256=7szw4rkwRyK3J-sUTcVZHdwoLIZqlYo8XolJnZdjOww,4571
107
108
  mcp_agent/mcp/interfaces.py,sha256=NxUDi4eI-qWfaOS1QHWr3EjAweV-CX_CBJeBCwTwr7g,7102
108
109
  mcp_agent/mcp/logger_textio.py,sha256=vljC1BtNTCxBAda9ExqNB-FwVNUZIuJT3h1nWmCjMws,3172
109
110
  mcp_agent/mcp/mcp_agent_client_session.py,sha256=nEHrSalG5z47BKGwE9ooOmlSTc4Gb7qdEut071Dwepo,8987
110
- mcp_agent/mcp/mcp_aggregator.py,sha256=Q2hHT_fcm6QIJ96si88AWaHxPh4NB50g3nr2lfGGZV0,48753
111
+ mcp_agent/mcp/mcp_aggregator.py,sha256=D1xFBVVq_4Tn1Ka16SZTVB3qeU-FO5501ITHGXTuXs0,49730
111
112
  mcp_agent/mcp/mcp_connection_manager.py,sha256=dJxjnv2IRzlFIxrbPFl39-pmGcZHgyeMXVlMfqpREhE,17974
112
113
  mcp_agent/mcp/mime_utils.py,sha256=difepNR_gpb4MpMLkBRAoyhDk-AjXUHTiqKvT_VwS1o,1805
113
114
  mcp_agent/mcp/prompt_message_multipart.py,sha256=BDwRdNwyWHb2q2bccDb2iR2VlORqVvkvoG3xYzcMpCE,4403
@@ -160,8 +161,8 @@ mcp_agent/resources/examples/workflows/short_story.md,sha256=XN9I2kzCcMmke3dE5F2
160
161
  mcp_agent/resources/examples/workflows/short_story.txt,sha256=X3y_1AyhLFN2AKzCKvucJtDgAFIJfnlbsbGZO5bBWu0,1187
161
162
  mcp_agent/tools/tool_definition.py,sha256=L3Pxl-uLEXqlVoo-bYuFTFALeI-2pIU44YgFhsTKEtM,398
162
163
  mcp_agent/ui/console_display.py,sha256=U9ZWzeu3dUGNCDcyFVSTqX_rpxXbn3uNmuvJ4SIlzi0,15730
163
- fast_agent_mcp-0.2.41.dist-info/METADATA,sha256=SbuDturRmLzPWvatrCfSzeNkiOwrvLvZuK_u0jnn-uY,30983
164
- fast_agent_mcp-0.2.41.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
165
- fast_agent_mcp-0.2.41.dist-info/entry_points.txt,sha256=QaX5kLdI0VdMPRdPUF1nkG_WdLUTNjp_icW6e3EhNYU,232
166
- fast_agent_mcp-0.2.41.dist-info/licenses/LICENSE,sha256=Gx1L3axA4PnuK4FxsbX87jQ1opoOkSFfHHSytW6wLUU,10935
167
- fast_agent_mcp-0.2.41.dist-info/RECORD,,
164
+ fast_agent_mcp-0.2.43.dist-info/METADATA,sha256=GzA8s5uVpEhN0t0iJD4E7Qy0SyvDfkrl1K5LYRellzg,31012
165
+ fast_agent_mcp-0.2.43.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
166
+ fast_agent_mcp-0.2.43.dist-info/entry_points.txt,sha256=QaX5kLdI0VdMPRdPUF1nkG_WdLUTNjp_icW6e3EhNYU,232
167
+ fast_agent_mcp-0.2.43.dist-info/licenses/LICENSE,sha256=Gx1L3axA4PnuK4FxsbX87jQ1opoOkSFfHHSytW6wLUU,10935
168
+ fast_agent_mcp-0.2.43.dist-info/RECORD,,
@@ -6,6 +6,7 @@ and delegates operations to an attached AugmentedLLMProtocol instance.
6
6
  """
7
7
 
8
8
  import asyncio
9
+ import fnmatch
9
10
  import uuid
10
11
  from typing import (
11
12
  TYPE_CHECKING,
@@ -13,6 +14,7 @@ from typing import (
13
14
  Callable,
14
15
  Dict,
15
16
  List,
17
+ Mapping,
16
18
  Optional,
17
19
  Tuple,
18
20
  Type,
@@ -325,9 +327,29 @@ class BaseAgent(MCPAggregator, AgentProtocol):
325
327
  self.logger.debug("Received human input signal", data=result)
326
328
  return result
327
329
 
330
+ def _matches_pattern(self, name: str, pattern: str, server_name: str) -> bool:
331
+ """
332
+ Check if a name matches a pattern for a specific server.
333
+
334
+ Args:
335
+ name: The name to match (could be tool name, resource URI, or prompt name)
336
+ pattern: The pattern to match against (e.g., "add", "math*", "resource://math/*")
337
+ server_name: The server name (used for tool name prefixing)
338
+
339
+ Returns:
340
+ True if the name matches the pattern
341
+ """
342
+ # For tools, build the full pattern with server prefix: server_name-pattern
343
+ if name.startswith(f"{server_name}-"):
344
+ full_pattern = f"{server_name}-{pattern}"
345
+ return fnmatch.fnmatch(name, full_pattern)
346
+
347
+ # For resources and prompts, match directly against the pattern
348
+ return fnmatch.fnmatch(name, pattern)
349
+
328
350
  async def list_tools(self) -> ListToolsResult:
329
351
  """
330
- List all tools available to this agent.
352
+ List all tools available to this agent, filtered by configuration.
331
353
 
332
354
  Returns:
333
355
  ListToolsResult with available tools
@@ -335,8 +357,26 @@ class BaseAgent(MCPAggregator, AgentProtocol):
335
357
  if not self.initialized:
336
358
  await self.initialize()
337
359
 
360
+ # Get all tools from the parent class
338
361
  result = await super().list_tools()
339
362
 
363
+ # Apply filtering if tools are specified in config
364
+ if self.config.tools is not None:
365
+ filtered_tools = []
366
+ for tool in result.tools:
367
+ # Extract server name from tool name (e.g., "mathematics-add" -> "mathematics")
368
+ if '-' in tool.name:
369
+ server_name = tool.name.split('-', 1)[0]
370
+
371
+ # Check if this server has tool filters
372
+ if server_name in self.config.tools:
373
+ # Check if tool matches any pattern for this server
374
+ for pattern in self.config.tools[server_name]:
375
+ if self._matches_pattern(tool.name, pattern, server_name):
376
+ filtered_tools.append(tool)
377
+ break
378
+ result.tools = filtered_tools
379
+
340
380
  if not self.human_input_callback:
341
381
  return result
342
382
 
@@ -635,6 +675,76 @@ class BaseAgent(MCPAggregator, AgentProtocol):
635
675
  response = await self.generate(prompts, request_params)
636
676
  return response.first_text()
637
677
 
678
+ async def list_prompts(self, server_name: str | None = None) -> Mapping[str, List[Prompt]]:
679
+ """
680
+ List all prompts available to this agent, filtered by configuration.
681
+
682
+ Args:
683
+ server_name: Optional server name to list prompts from
684
+
685
+ Returns:
686
+ Dictionary mapping server names to lists of Prompt objects
687
+ """
688
+ if not self.initialized:
689
+ await self.initialize()
690
+
691
+ # Get all prompts from the parent class
692
+ result = await super().list_prompts(server_name)
693
+
694
+ # Apply filtering if prompts are specified in config
695
+ if self.config.prompts is not None:
696
+ filtered_result = {}
697
+ for server, prompts in result.items():
698
+ # Check if this server has prompt filters
699
+ if server in self.config.prompts:
700
+ filtered_prompts = []
701
+ for prompt in prompts:
702
+ # Check if prompt matches any pattern for this server
703
+ for pattern in self.config.prompts[server]:
704
+ if self._matches_pattern(prompt.name, pattern, server):
705
+ filtered_prompts.append(prompt)
706
+ break
707
+ if filtered_prompts:
708
+ filtered_result[server] = filtered_prompts
709
+ result = filtered_result
710
+
711
+ return result
712
+
713
+ async def list_resources(self, server_name: str | None = None) -> Dict[str, List[str]]:
714
+ """
715
+ List all resources available to this agent, filtered by configuration.
716
+
717
+ Args:
718
+ server_name: Optional server name to list resources from
719
+
720
+ Returns:
721
+ Dictionary mapping server names to lists of resource URIs
722
+ """
723
+ if not self.initialized:
724
+ await self.initialize()
725
+
726
+ # Get all resources from the parent class
727
+ result = await super().list_resources(server_name)
728
+
729
+ # Apply filtering if resources are specified in config
730
+ if self.config.resources is not None:
731
+ filtered_result = {}
732
+ for server, resources in result.items():
733
+ # Check if this server has resource filters
734
+ if server in self.config.resources:
735
+ filtered_resources = []
736
+ for resource in resources:
737
+ # Check if resource matches any pattern for this server
738
+ for pattern in self.config.resources[server]:
739
+ if self._matches_pattern(resource, pattern, server):
740
+ filtered_resources.append(resource)
741
+ break
742
+ if filtered_resources:
743
+ filtered_result[server] = filtered_resources
744
+ result = filtered_result
745
+
746
+ return result
747
+
638
748
  @property
639
749
  def agent_type(self) -> AgentType:
640
750
  """
mcp_agent/config.py CHANGED
@@ -253,6 +253,20 @@ class TensorZeroSettings(BaseModel):
253
253
  model_config = ConfigDict(extra="allow", arbitrary_types_allowed=True)
254
254
 
255
255
 
256
+ class BedrockSettings(BaseModel):
257
+ """
258
+ Settings for using AWS Bedrock models in the fast-agent application.
259
+ """
260
+
261
+ region: str | None = None
262
+ """AWS region for Bedrock service"""
263
+
264
+ profile: str | None = None
265
+ """AWS profile to use for authentication"""
266
+
267
+ model_config = ConfigDict(extra="allow", arbitrary_types_allowed=True)
268
+
269
+
256
270
  class HuggingFaceSettings(BaseModel):
257
271
  """
258
272
  Settings for HuggingFace authentication (used for MCP connections).
@@ -419,6 +433,9 @@ class Settings(BaseSettings):
419
433
  aliyun: OpenAISettings | None = None
420
434
  """Settings for using Aliyun OpenAI Service in the fast-agent application"""
421
435
 
436
+ bedrock: BedrockSettings | None = None
437
+ """Settings for using AWS Bedrock models in the fast-agent application"""
438
+
422
439
  huggingface: HuggingFaceSettings | None = None
423
440
  """Settings for HuggingFace authentication (used for MCP connections)"""
424
441
 
@@ -4,7 +4,7 @@ Type definitions for agents and agent configurations.
4
4
 
5
5
  from dataclasses import dataclass, field
6
6
  from enum import Enum
7
- from typing import List
7
+ from typing import Dict, List, Optional
8
8
 
9
9
  from mcp.client.session import ElicitationFnT
10
10
 
@@ -31,6 +31,9 @@ class AgentConfig:
31
31
  name: str
32
32
  instruction: str = "You are a helpful agent."
33
33
  servers: List[str] = field(default_factory=list)
34
+ tools: Optional[Dict[str, List[str]]] = None
35
+ resources: Optional[Dict[str, List[str]]] = None
36
+ prompts: Optional[Dict[str, List[str]]] = None
34
37
  model: str | None = None
35
38
  use_history: bool = True
36
39
  default_request_params: RequestParams | None = None
@@ -9,6 +9,7 @@ from functools import wraps
9
9
  from typing import (
10
10
  Awaitable,
11
11
  Callable,
12
+ Dict,
12
13
  List,
13
14
  Literal,
14
15
  Optional,
@@ -93,6 +94,9 @@ def _decorator_impl(
93
94
  request_params: RequestParams | None = None,
94
95
  human_input: bool = False,
95
96
  default: bool = False,
97
+ tools: Optional[Dict[str, List[str]]] = None,
98
+ resources: Optional[Dict[str, List[str]]] = None,
99
+ prompts: Optional[Dict[str, List[str]]] = None,
96
100
  **extra_kwargs,
97
101
  ) -> Callable[[AgentCallable[P, R]], DecoratedAgentProtocol[P, R]]:
98
102
  """
@@ -133,6 +137,9 @@ def _decorator_impl(
133
137
  name=name,
134
138
  instruction=instruction,
135
139
  servers=servers,
140
+ tools=tools,
141
+ resources=resources,
142
+ prompts=prompts,
136
143
  model=model,
137
144
  use_history=use_history,
138
145
  human_input=human_input,
@@ -177,6 +184,9 @@ def agent(
177
184
  *,
178
185
  instruction: str = "You are a helpful agent.",
179
186
  servers: List[str] = [],
187
+ tools: Optional[Dict[str, List[str]]] = None,
188
+ resources: Optional[Dict[str, List[str]]] = None,
189
+ prompts: Optional[Dict[str, List[str]]] = None,
180
190
  model: Optional[str] = None,
181
191
  use_history: bool = True,
182
192
  request_params: RequestParams | None = None,
@@ -193,12 +203,16 @@ def agent(
193
203
  instruction_or_kwarg: Optional positional parameter for instruction
194
204
  instruction: Base instruction for the agent (keyword arg)
195
205
  servers: List of server names the agent should connect to
206
+ tools: Optional list of tool names or patterns to include
207
+ resources: Optional list of resource names or patterns to include
208
+ prompts: Optional list of prompt names or patterns to include
196
209
  model: Model specification string
197
210
  use_history: Whether to maintain conversation history
198
211
  request_params: Additional request parameters for the LLM
199
212
  human_input: Whether to enable human input capabilities
200
213
  default: Whether to mark this as the default agent
201
214
  elicitation_handler: Custom elicitation handler function (ElicitationFnT)
215
+ api_key: Optional API key for the LLM provider
202
216
 
203
217
  Returns:
204
218
  A decorator that registers the agent with proper type annotations
@@ -217,6 +231,9 @@ def agent(
217
231
  human_input=human_input,
218
232
  default=default,
219
233
  elicitation_handler=elicitation_handler,
234
+ tools=tools,
235
+ resources=resources,
236
+ prompts=prompts,
220
237
  api_key=api_key,
221
238
  )
222
239
 
@@ -229,6 +246,9 @@ def custom(
229
246
  *,
230
247
  instruction: str = "You are a helpful agent.",
231
248
  servers: List[str] = [],
249
+ tools: Optional[Dict[str, List[str]]] = None,
250
+ resources: Optional[Dict[str, List[str]]] = None,
251
+ prompts: Optional[Dict[str, List[str]]] = None,
232
252
  model: Optional[str] = None,
233
253
  use_history: bool = True,
234
254
  request_params: RequestParams | None = None,
@@ -270,6 +290,9 @@ def custom(
270
290
  default=default,
271
291
  elicitation_handler=elicitation_handler,
272
292
  api_key=api_key,
293
+ tools=tools,
294
+ resources=resources,
295
+ prompts=prompts,
273
296
  )
274
297
 
275
298
 
@@ -344,6 +367,9 @@ def router(
344
367
  agents: List[str],
345
368
  instruction: Optional[str] = None,
346
369
  servers: List[str] = [],
370
+ tools: Optional[Dict[str, List[str]]] = None,
371
+ resources: Optional[Dict[str, List[str]]] = None,
372
+ prompts: Optional[Dict[str, List[str]]] = None,
347
373
  model: Optional[str] = None,
348
374
  use_history: bool = False,
349
375
  request_params: RequestParams | None = None,
@@ -392,6 +418,9 @@ def router(
392
418
  router_agents=agents,
393
419
  elicitation_handler=elicitation_handler,
394
420
  api_key=api_key,
421
+ tools=tools,
422
+ prompts=prompts,
423
+ resources=resources,
395
424
  ),
396
425
  )
397
426
 
@@ -68,6 +68,11 @@ async def _display_agent_info_helper(agent_name: str, agent_provider: object) ->
68
68
  len(tools_result.tools) if tools_result and hasattr(tools_result, "tools") else 0
69
69
  )
70
70
 
71
+ resources_dict = await agent.list_resources()
72
+ resource_count = (
73
+ sum(len(resources) for resources in resources_dict.values()) if resources_dict else 0
74
+ )
75
+
71
76
  prompts_dict = await agent.list_prompts()
72
77
  prompt_count = sum(len(prompts) for prompts in prompts_dict.values()) if prompts_dict else 0
73
78
 
@@ -104,10 +109,11 @@ async def _display_agent_info_helper(agent_name: str, agent_provider: object) ->
104
109
  # Pluralization helpers
105
110
  server_word = "Server" if server_count == 1 else "Servers"
106
111
  tool_word = "tool" if tool_count == 1 else "tools"
112
+ resource_word = "resource" if resource_count == 1 else "resources"
107
113
  prompt_word = "prompt" if prompt_count == 1 else "prompts"
108
114
 
109
115
  rich_print(
110
- f"[dim]Agent [/dim][blue]{agent_name}[/blue][dim]:[/dim] {server_count:,}[dim] MCP {server_word}, [/dim]{tool_count:,}[dim] {tool_word}, [/dim]{prompt_count:,}[dim] {prompt_word} available[/dim]"
116
+ f"[dim]Agent [/dim][blue]{agent_name}[/blue][dim]:[/dim] {server_count:,}[dim] MCP {server_word}, [/dim]{tool_count:,}[dim] {tool_word}, [/dim]{resource_count:,}[dim] {resource_word}, [/dim]{prompt_count:,}[dim] {prompt_word} available[/dim]"
111
117
  )
112
118
 
113
119
  # Mark as shown
@@ -221,6 +227,11 @@ async def _display_child_agent_info(child_agent, prefix: str, agent_provider) ->
221
227
  len(tools_result.tools) if tools_result and hasattr(tools_result, "tools") else 0
222
228
  )
223
229
 
230
+ resources_dict = await child_agent.list_resources()
231
+ resource_count = (
232
+ sum(len(resources) for resources in resources_dict.values()) if resources_dict else 0
233
+ )
234
+
224
235
  prompts_dict = await child_agent.list_prompts()
225
236
  prompt_count = sum(len(prompts) for prompts in prompts_dict.values()) if prompts_dict else 0
226
237
 
@@ -229,10 +240,11 @@ async def _display_child_agent_info(child_agent, prefix: str, agent_provider) ->
229
240
  # Pluralization helpers
230
241
  server_word = "Server" if server_count == 1 else "Servers"
231
242
  tool_word = "tool" if tool_count == 1 else "tools"
243
+ resource_word = "resource" if resource_count == 1 else "resources"
232
244
  prompt_word = "prompt" if prompt_count == 1 else "prompts"
233
245
 
234
246
  rich_print(
235
- f"[dim] {prefix} [/dim][blue]{child_agent.name}[/blue][dim]:[/dim] {server_count:,}[dim] MCP {server_word}, [/dim]{tool_count:,}[dim] {tool_word}, [/dim]{prompt_count:,}[dim] {prompt_word} available[/dim]"
247
+ f"[dim] {prefix} [/dim][blue]{child_agent.name}[/blue][dim]:[/dim] {server_count:,}[dim] MCP {server_word}, [/dim]{tool_count:,}[dim] {tool_word}, [/dim]{resource_count:,}[dim] {resource_word}, [/dim]{prompt_count:,}[dim] {prompt_word} available[/dim]"
236
248
  )
237
249
  else:
238
250
  # Show child even without MCP servers for context
@@ -14,6 +14,7 @@ from mcp_agent.llm.provider_types import Provider
14
14
  from mcp_agent.llm.providers.augmented_llm_aliyun import AliyunAugmentedLLM
15
15
  from mcp_agent.llm.providers.augmented_llm_anthropic import AnthropicAugmentedLLM
16
16
  from mcp_agent.llm.providers.augmented_llm_azure import AzureOpenAIAugmentedLLM
17
+ from mcp_agent.llm.providers.augmented_llm_bedrock import BedrockAugmentedLLM
17
18
  from mcp_agent.llm.providers.augmented_llm_deepseek import DeepSeekAugmentedLLM
18
19
  from mcp_agent.llm.providers.augmented_llm_generic import GenericAugmentedLLM
19
20
  from mcp_agent.llm.providers.augmented_llm_google_native import GoogleNativeAugmentedLLM
@@ -41,6 +42,7 @@ LLMClass = Union[
41
42
  Type[GoogleNativeAugmentedLLM],
42
43
  Type[GenericAugmentedLLM],
43
44
  Type[AzureOpenAIAugmentedLLM],
45
+ Type[BedrockAugmentedLLM],
44
46
  ]
45
47
 
46
48
 
@@ -120,6 +122,7 @@ class ModelFactory:
120
122
  "qwen-plus": Provider.ALIYUN,
121
123
  "qwen-max": Provider.ALIYUN,
122
124
  "qwen-long": Provider.ALIYUN,
125
+
123
126
  }
124
127
 
125
128
  MODEL_ALIASES = {
@@ -155,6 +158,7 @@ class ModelFactory:
155
158
  Provider.TENSORZERO: TensorZeroAugmentedLLM,
156
159
  Provider.AZURE: AzureOpenAIAugmentedLLM,
157
160
  Provider.ALIYUN: AliyunAugmentedLLM,
161
+ Provider.BEDROCK: BedrockAugmentedLLM,
158
162
  }
159
163
 
160
164
  # Mapping of special model names to their specific LLM classes
@@ -209,6 +213,11 @@ class ModelFactory:
209
213
  # If provider still None, try to get from DEFAULT_PROVIDERS using the model_name_str
210
214
  if provider is None:
211
215
  provider = cls.DEFAULT_PROVIDERS.get(model_name_str)
216
+
217
+ # If still None, try pattern matching for Bedrock models
218
+ if provider is None and BedrockAugmentedLLM.matches_model_pattern(model_name_str):
219
+ provider = Provider.BEDROCK
220
+
212
221
  if provider is None:
213
222
  raise ModelConfigError(
214
223
  f"Unknown model or provider for: {model_string}. Model name parsed as '{model_name_str}'"
@@ -27,3 +27,4 @@ class Provider(Enum):
27
27
  ALIYUN = ("aliyun", "Aliyun") # Aliyun Bailian OpenAI Service
28
28
  HUGGINGFACE = ("huggingface", "HuggingFace") # For HuggingFace MCP connections
29
29
  XAI = ("xai", "XAI") # For xAI Grok models
30
+ BEDROCK = ("bedrock", "Bedrock")