MCPcopy Index your code
hub / github.com/google/adk-python / check_prime

Function check_prime

contributing/samples/multi_agent/hello_world_ma/agent.py:52–70  ·  view source on GitHub ↗

Check if a given list of numbers are prime.

(nums: list[int])

Source from the content-addressed store, hash-verified

50
51# --- Prime Check Sub-Agent ---
52def check_prime(nums: list[int]) -> str:
53 """Check if a given list of numbers are prime."""
54 primes = set()
55 for number in nums:
56 number = int(number)
57 if number <= 1:
58 continue
59 is_prime = True
60 for i in range(2, int(number**0.5) + 1):
61 if number % i == 0:
62 is_prime = False
63 break
64 if is_prime:
65 primes.add(number)
66 return (
67 "No prime numbers found."
68 if not primes
69 else f"{', '.join(str(num) for num in primes)} are prime numbers."
70 )
71
72
73example_tool = ExampleTool(

Callers

nothing calls this directly

Calls 3

setFunction · 0.85
addMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected