Skip to content

fix: show tool descriptions in CLI tools output for all docstring styles - #409

Merged
AutomateIP merged 1 commit into
itential:develfrom
AutomateIP:fix/cli-tool-description-blank
Aug 13, 2026
Merged

fix: show tool descriptions in CLI tools output for all docstring styles#409
AutomateIP merged 1 commit into
itential:develfrom
AutomateIP:fix/cli-tool-description-blank

Conversation

@AutomateIP

Copy link
Copy Markdown
Collaborator

Summary

The itential-mcp tools CLI subcommand rendered blank descriptions for 8
tools because display_tools() hardcoded __doc__.splitlines()[1], which
only worked for one docstring style and raised AttributeError on
undocumented tools.

Changes

  • utilities/tool.py: replace the hardcoded splitlines()[1] with
    inspect.getdoc() plus a first-non-blank-line scan; safely handle
    __doc__ is None.
  • tests/utilities/test_tool.py: add regression guards for Google-style,
    leading-blank, one-liner, and undocumented docstring shapes, plus a
    live test asserting the 8 previously-broken tools now render correct
    summaries.

Testing

  • make ci passes clean (2841 tests, ruff, headers, bandit).
  • Reverting the fix fails 3 of the new tests with the exact predicted
    errors, confirming they are genuine regression guards.
  • CLI-display-only change with no MCP protocol/wire impact
    (display_tools is wired only from the tools subcommand; FastMCP's
    tools/list derives descriptions independently at registration), so
    no live integration run is applicable.

Related Issues

Roadmap Tier B #28.

The itential-mcp tools CLI subcommand rendered blank descriptions for 8
tools because display_tools() hardcoded __doc__.splitlines()[1], which
only worked for one docstring style and would raise AttributeError on
undocumented tools.

Replace the hardcoded splitlines()[1] with inspect.getdoc() plus a
first-non-blank-line scan; safely handle __doc__ is None.

No MCP protocol/wire impact -- display_tools is wired only from the
CLI tools subcommand; FastMCP's tools/list derives descriptions
independently at registration.
@AutomateIP AutomateIP added the bug fix Fixes a bug in the application label Aug 13, 2026
@AutomateIP
AutomateIP merged commit e122a81 into itential:devel Aug 13, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix Fixes a bug in the application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant