Each tool accepts parameters that change its behaviour — max_results: 5 vs max_results: 100, query: "is:unread" vs no query at all. The dict you pass as the second argument is how you set them.
Where do I find the parameter names?
Composio's docs, or the existing scaffolds in lessons that use the same tool. For GMAIL_FETCH_EMAILS, the relevant ones are max_results (int), query (Gmail search syntax string), page_token (for pagination — ignore for now).
Today's exercise demonstrates max_results end to end: call once with 2, again with 5, and print each call's count.
for n in [2, 5]:
result = toolset.execute_action(Action.GMAIL_FETCH_EMAILS, {"max_results": n})
print(len(result.get("messages", [])))A loop that calls the API twice — and the parameter changes each iteration?
Same Python you've been writing. The API call is just an expression inside the loop body. Quota: each call costs one Composio slot, so the script burns 2 slots. Worth knowing as you scale up tests.
toolset.execute_action(Action.<TOOL>, { "param_1": value, "param_2": value })The dict is just a Python dict. You can build it dynamically:
args = {"max_results": 5}
if urgent_only:
args["query"] = "is:unread"
result = toolset.execute_action(Action.GMAIL_FETCH_EMAILS, args)Useful when the call configuration depends on conditions in your script.
GMAIL_FETCH_EMAILS parameters| Param | Type | Effect |
|---|---|---|
max_results | int | how many to return (caps at 500) |
query | str | Gmail search syntax — is:unread, from:x@y, subject:foo, etc. |
page_token | str | for pagination — pass the token from the prior response to get the next page |
Most beginner usage needs only max_results and query. Other tools have their own parameter sets — when in doubt, check Composio's docs for that specific tool slug.
Every execute_action call consumes one Composio quota slot from your account. The pro plan ships with a generous monthly allowance, but loops calling APIs add up fast. As a habit:
max_results to scope down — fetching 1000 messages when you only need 10 wastes both quota and bandwidthquery) over client-side when the API supports the filterDay 5's filtering lesson and today's parameter lesson combine into the rule: write the smallest API call that returns what you need.
Each tool accepts parameters that change its behaviour — max_results: 5 vs max_results: 100, query: "is:unread" vs no query at all. The dict you pass as the second argument is how you set them.
Where do I find the parameter names?
Composio's docs, or the existing scaffolds in lessons that use the same tool. For GMAIL_FETCH_EMAILS, the relevant ones are max_results (int), query (Gmail search syntax string), page_token (for pagination — ignore for now).
Today's exercise demonstrates max_results end to end: call once with 2, again with 5, and print each call's count.
for n in [2, 5]:
result = toolset.execute_action(Action.GMAIL_FETCH_EMAILS, {"max_results": n})
print(len(result.get("messages", [])))A loop that calls the API twice — and the parameter changes each iteration?
Same Python you've been writing. The API call is just an expression inside the loop body. Quota: each call costs one Composio slot, so the script burns 2 slots. Worth knowing as you scale up tests.
toolset.execute_action(Action.<TOOL>, { "param_1": value, "param_2": value })The dict is just a Python dict. You can build it dynamically:
args = {"max_results": 5}
if urgent_only:
args["query"] = "is:unread"
result = toolset.execute_action(Action.GMAIL_FETCH_EMAILS, args)Useful when the call configuration depends on conditions in your script.
GMAIL_FETCH_EMAILS parameters| Param | Type | Effect |
|---|---|---|
max_results | int | how many to return (caps at 500) |
query | str | Gmail search syntax — is:unread, from:x@y, subject:foo, etc. |
page_token | str | for pagination — pass the token from the prior response to get the next page |
Most beginner usage needs only max_results and query. Other tools have their own parameter sets — when in doubt, check Composio's docs for that specific tool slug.
Every execute_action call consumes one Composio quota slot from your account. The pro plan ships with a generous monthly allowance, but loops calling APIs add up fast. As a habit:
max_results to scope down — fetching 1000 messages when you only need 10 wastes both quota and bandwidthquery) over client-side when the API supports the filterDay 5's filtering lesson and today's parameter lesson combine into the rule: write the smallest API call that returns what you need.
Create a free account to get started. Paid plans unlock all tracks.