Skip to content

Improve execute_tool errors for mismatched tool input key casing #151

@saif-at-scalekit

Description

@saif-at-scalekit

Problem

Developers can confuse Gmail response field names with tool input parameter names. For example, gmail_fetch_mails response objects include camelCase fields such as threadId, but gmail_get_thread_by_id expects the tool input key thread_id.

If a caller passes {"threadId": "abc123"}, the current error reports that input.thread_id is missing. That is technically accurate, but it sends developers toward checking whether the value was extracted instead of noticing that the key casing is wrong.

Example

# Response extraction uses camelCase
thread_id = message.get("threadId", "")

# Tool input must use the schema key
response = client.actions.execute_tool(
    tool_name="gmail_get_thread_by_id",
    connected_account_id=connected_account_id,
    tool_input={"thread_id": thread_id},
)

Suggested fix

When execute_tool receives a required-field error and the submitted input contains a likely case-converted variant, return a more actionable message, for example:

Required field 'thread_id' not found. Did you mean 'threadId'? Tool input keys must match the snake_case schema shown for this tool.

If the Python SDK does not have enough schema context at this layer, this should be coordinated with the API/service error response and surfaced cleanly by the SDK.

Developer impact

This reduces a common debug loop when chaining tool responses into follow-up tool calls, especially for Gmail fields such as threadId -> thread_id and messageId -> message_id.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions