2525)
2626
2727import mcp
28- from a2a .types import AgentCard , AgentSkill
28+ from a2a .types import AgentCard , AgentInterface , AgentSkill
2929from mcp .types import (
3030 CallToolResult ,
3131 ContentBlock ,
@@ -489,6 +489,12 @@ def _local_filesystem_runtime(self) -> LocalFilesystemRuntime | None:
489489 return fallback
490490 return None
491491
492+ def _consume_pending_media_attachments (self ) -> list [ContentBlock ]:
493+ local_runtime = self ._local_filesystem_runtime ()
494+ if local_runtime is None :
495+ return []
496+ return local_runtime .consume_pending_media_attachments ()
497+
492498 @property
493499 def has_filesystem_read_text_file_tool (self ) -> bool :
494500 """Whether the active filesystem runtime currently exposes read_text_file."""
@@ -648,6 +654,12 @@ def _shell_read_text_file_enabled(self) -> bool:
648654 return True
649655 return self ._context .config .shell_execution .enable_read_text_file
650656
657+ def _shell_attach_media_mode (self ) -> Literal ["auto" , "on" , "off" ]:
658+ """Return whether shell-enabled agents should expose local attach_media."""
659+ if not self ._context or not self ._context .config :
660+ return "auto"
661+ return self ._context .config .shell_execution .enable_attach_media
662+
651663 def _resolve_shell_edit_tool_mode (self ) -> Literal ["write_text_file" , "apply_patch" , "off" ]:
652664 """Return which shell edit tool should be exposed for the current model/config."""
653665 default_mode : Literal ["write_text_file" , "apply_patch" ]
@@ -713,16 +725,20 @@ def _maybe_enable_local_filesystem_runtime(self, working_directory: Path | None
713725 enable_write = edit_mode == "write_text_file"
714726 enable_apply_patch = edit_mode == "apply_patch"
715727 enable_edit_file = edit_mode == "write_text_file"
728+ enable_attach_media = self ._shell_attach_media_mode ()
729+ model_info = self .llm .model_info if self .llm else None
716730 local_runtime = self ._local_filesystem_runtime ()
717731 if local_runtime is not None :
718732 if working_directory is not None :
719733 local_runtime .set_working_directory (working_directory )
734+ local_runtime .set_model_info (model_info )
720735 local_runtime .set_tool_handler_resolver (self ._get_tool_handler )
721736 local_runtime .set_enabled_tools (
722737 enable_read = enable_read ,
723738 enable_write = enable_write ,
724739 enable_apply_patch = enable_apply_patch ,
725740 enable_edit_file = enable_edit_file ,
741+ enable_attach_media = enable_attach_media ,
726742 )
727743 return
728744
@@ -736,6 +752,8 @@ def _maybe_enable_local_filesystem_runtime(self, working_directory: Path | None
736752 enable_write = enable_write ,
737753 enable_apply_patch = enable_apply_patch ,
738754 enable_edit_file = enable_edit_file ,
755+ enable_attach_media = enable_attach_media ,
756+ model_info = model_info ,
739757 tool_handler_resolver = self ._get_tool_handler ,
740758 )
741759 if self ._filesystem_runtime is None :
@@ -752,6 +770,7 @@ def _maybe_enable_local_filesystem_runtime(self, working_directory: Path | None
752770 write_enabled = enable_write ,
753771 apply_patch_enabled = enable_apply_patch ,
754772 edit_file_enabled = enable_edit_file ,
773+ attach_media_enabled = enable_attach_media ,
755774 )
756775
757776 def _shell_output_limit_overridden (self ) -> bool :
@@ -779,11 +798,13 @@ def _on_llm_attached(self, llm: FastAgentLLMProtocol) -> None:
779798 local_runtime = self ._local_filesystem_runtime ()
780799 if local_runtime is not None :
781800 edit_mode = self ._resolve_shell_edit_tool_mode ()
801+ local_runtime .set_model_info (llm .model_info )
782802 local_runtime .set_enabled_tools (
783803 enable_read = self ._shell_read_text_file_enabled (),
784804 enable_write = edit_mode == "write_text_file" ,
785805 enable_apply_patch = edit_mode == "apply_patch" ,
786806 enable_edit_file = edit_mode == "write_text_file" ,
807+ enable_attach_media = self ._shell_attach_media_mode (),
787808 )
788809
789810 if self ._shell_runtime is None :
@@ -2032,7 +2053,12 @@ async def agent_card(self) -> AgentCard:
20322053 skills = skills ,
20332054 name = self ._name ,
20342055 description = self .config .description or self .instruction ,
2035- url = f"fast-agent://agents/{ self ._name } /" ,
2056+ supported_interfaces = [
2057+ AgentInterface (
2058+ url = f"fast-agent://agents/{ self ._name } /" ,
2059+ protocol_binding = "fast-agent" ,
2060+ )
2061+ ],
20362062 version = "0.1" ,
20372063 capabilities = DEFAULT_CAPABILITIES ,
20382064 default_input_modes = ["text/plain" ],
0 commit comments