Skip to content

Fix name shadowing bug in find_name_variants tool - #5

Open
dmarshall-rgb wants to merge 2 commits into
airy10:mainfrom
dmarshall-rgb:fix-find-name-variants-shadowing
Open

Fix name shadowing bug in find_name_variants tool#5
dmarshall-rgb wants to merge 2 commits into
airy10:mainfrom
dmarshall-rgb:fix-find-name-variants-shadowing

Conversation

@dmarshall-rgb

Copy link
Copy Markdown
Contributor

The find_name_variants MCP tool imported a utility function of the same name from gedcom_name_utils. Once @mcp.tool() decorated the async function, it rebound the module-level name find_name_variants to a FunctionTool object, shadowing the earlier import. The tool's internal call to find_name_variants(name_string) then resolved to that FunctionTool object instead of the utility function, causing: 'FunctionTool' object is not callable.

Fix: aliased the import as _find_name_variants and updated the call site to use the alias, avoiding the name collision.

Verified via direct repro script and live MCP tool calls (find_name_variants('Enoch') -> ['Enoch', 'E.'], find_name_variants('Thomas') -> ['Thomas', 'T.']).

The find_name_variants MCP tool imported a utility function of the same name from gedcom_name_utils. Once @mcp.tool() decorated the async function, it rebound the module-level name find_name_variants to a FunctionTool object, shadowing the earlier import. The tool's internal call to find_name_variants(name_string) then resolved to that FunctionTool object instead of the utility function, causing: 'FunctionTool' object is not callable.

Fix: aliased the import as _find_name_variants and updated the call site to use the alias, avoiding the name collision.

Verified via direct repro script and live MCP tool calls (find_name_variants('Enoch') -> ['Enoch', 'E.'], find_name_variants('Thomas') -> ['Thomas', 'T.']).

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request resolves a name shadowing issue in src/gedcom_mcp/fastmcp_server.py by aliasing the imported find_name_variants function to _find_name_variants to avoid conflict with the MCP tool of the same name. The reviewer correctly points out that several other MCP tools in the same file (normalize_name, normalize_place_name, and extract_geographic_hierarchy) suffer from the exact same shadowing bug and suggests applying the same aliasing pattern to them.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/gedcom_mcp/fastmcp_server.py
…xtract_geographic_hierarchy tools

Same root cause as the find_name_variants fix in this branch: each of these MCP tools imported a utility function of the same name, and @mcp.tool() decoration rebound the module-level name to a FunctionTool object, shadowing the import. The tool's internal call then failed with 'FunctionTool' object is not callable.

Fix: aliased each import (_normalize_name, _normalize_place_name, _extract_geographic_hierarchy) and updated the corresponding call sites, matching the pattern already used for find_name_variants.

Verified via repro script and live MCP tool calls for all three tools.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant