MCPcopy Create free account
hub / github.com/IBM/mcp-cli / execute

Method execute

src/mcp_cli/commands/attach/attach.py:71–100  ·  view source on GitHub ↗

Execute the /attach command.

(self, **kwargs: Any)

Source from the content-addressed store, hash-verified

69 ]
70
71 async def execute(self, **kwargs: Any) -> CommandResult:
72 """Execute the /attach command."""
73 chat_context = kwargs.get("chat_context")
74 if not chat_context:
75 return CommandResult(
76 success=False,
77 error="Attach command requires chat context.",
78 )
79
80 # Parse arguments
81 args_val = kwargs.get("args", "")
82 if isinstance(args_val, list):
83 args_str = " ".join(str(a) for a in args_val)
84 else:
85 args_str = str(args_val).strip() if args_val else ""
86
87 if not args_str:
88 return self._show_usage()
89
90 parts = args_str.split()
91 action = parts[0].lower()
92
93 # Subcommands
94 if action == "list":
95 return self._list_staged(chat_context)
96 if action == "clear":
97 return self._clear_staged(chat_context)
98
99 # Treat all parts as file paths to stage
100 return self._stage_files(chat_context, parts)
101
102 # ── Subcommand handlers ──────────────────────────────────────────────
103

Callers

nothing calls this directly

Calls 6

_show_usageMethod · 0.95
_list_stagedMethod · 0.95
_clear_stagedMethod · 0.95
_stage_filesMethod · 0.95
CommandResultClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected