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

Method execute

src/mcp_cli/commands/usage/usage.py:48–63  ·  view source on GitHub ↗

Execute the usage command.

(self, **kwargs)

Source from the content-addressed store, hash-verified

46 return []
47
48 async def execute(self, **kwargs) -> CommandResult:
49 """Execute the usage command."""
50 chat_context = kwargs.get("chat_context")
51 if not chat_context:
52 return CommandResult(success=False, error="No chat context available.")
53
54 tracker = getattr(chat_context, "token_tracker", None)
55 if tracker is None or tracker.turn_count == 0:
56 output.info("No token usage recorded yet.")
57 return CommandResult(success=True, output="No usage data.")
58
59 # Format summary
60 summary = tracker.format_summary()
61 output.panel(summary, title="Token Usage")
62
63 return CommandResult(success=True, output=summary)

Callers

nothing calls this directly

Calls 3

CommandResultClass · 0.90
format_summaryMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected