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

Method _execute

examples/sample_tools/search_tool.py:21–33  ·  view source on GitHub ↗

Simulate web search.

(self, query: str, num_results: int)

Source from the content-addressed store, hash-verified

19 results: List[Dict[str, str]]
20
21 def _execute(self, query: str, num_results: int) -> Dict:
22 """Simulate web search."""
23 time.sleep(0.8) # pretend latency
24 return {
25 "results": [
26 {
27 "title": f"Result {i + 1} for {query}",
28 "url": f"https://example.com/result{i + 1}",
29 "snippet": f"This is a search result about {query}.",
30 }
31 for i in range(num_results)
32 ]
33 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected