Skip to content

fix: route get_templates through GetTemplatesResponse RootModel to remove startup output_schema warning - #405

Merged
AutomateIP merged 1 commit into
itential:develfrom
AutomateIP:fix/templates-get-templates-rootmodel
Aug 10, 2026
Merged

fix: route get_templates through GetTemplatesResponse RootModel to remove startup output_schema warning#405
AutomateIP merged 1 commit into
itential:develfrom
AutomateIP:fix/templates-get-templates-rootmodel

Conversation

@AutomateIP

Copy link
Copy Markdown
Collaborator

Summary

templates.get_templates was the last tool returning a bare
list[models.GetTemplatesElement] instead of a Pydantic model. That bare-list
return annotation caused get_json_schema to raise ValueError, which
server.py catches and logs as "tool get_templates has a missing or invalid
output_schema" on every startup. This wires the tool to the existing (and
previously unused) GetTemplatesResponse(RootModel), silencing the warning and
aligning with the repo-wide pattern.

This is type-hygiene and warning removal, not a schema bug fix: FastMCP was
already inferring an equivalent object-rooted output schema for the bare list,
so the wire-level output schema and JSON payload are byte-equivalent before and
after. No client-visible behavior change.

Changes

  • src/itential_mcp/tools/templates.py: return annotation changed to
    models.GetTemplatesResponse; return value wrapped as
    GetTemplatesResponse(root=results); docstring Returns: updated.
  • tests/test_tools_templates.py: assertions adapted from bare-list to the
    wrapped RootModel (result.root); coverage preserved.
  • tests/utilities/test_tool.py: added regression test asserting
    get_json_schema(get_templates) no longer raises and returns a type: array
    schema.
  • AGENTS.md: removed the now-resolved tech-debt note (item Fixes spelling error in README.md聽#6).

Testing

  • make ci passes clean (2833 tests).
  • Verified live against a real Itential Platform: server starts with the
    startup warning gone (git-stash A/B comparison), a real get_templates call
    returned 278 templates with unchanged wire shape, tools/list
    annotations/title intact, no regression in other tools.

Related Issues

Resolves the templates.py:get_templates bare-list tech-debt item (AGENTS.md
item #6; roadmap Tier D1 #24 / G22).

Route templates.get_templates through the existing (previously unused)
GetTemplatesResponse RootModel instead of returning a bare
list[GetTemplatesElement]. This was the last tool whose bare-list return
annotation tripped a "missing or invalid output_schema" ValueError in
get_json_schema, logging a spurious warning on every server startup.

The wire-level output schema and JSON payload are byte-equivalent before
and after: FastMCP already inferred an object-wrapped result array for
the bare list, and it continues to do so for the array-rooted RootModel
(server.py's == object guard intentionally leaves the array-root schema
to FastMCP inference). This is type-hygiene plus warning removal, not a
wire-behavior change.

Also removes the now-resolved tech-debt note from AGENTS.md (CLAUDE.md
symlink).
@AutomateIP AutomateIP added the bug fix Fixes a bug in the application label Aug 10, 2026
@AutomateIP
AutomateIP merged commit c08e51d into itential:devel Aug 10, 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