Skip to content

Conversation

@carlos-gn
Copy link

Summary

This PR removes the redundant ToolType field from the Workload struct. The field mapped to either "mcp" (container workloads) or "remote" (remote workloads), but since MCP is the only alternative type in practice, the field has become unnecessary.

Changes

  • ✅ Remove ToolType field from core.Workload struct
  • ✅ Delete LabelToolType constant and GetToolType() function from labels package
  • ✅ Simplify shouldSkipWorkload() logic in client manager
  • ✅ Remove ToolType from CLI list command output
  • ✅ Remove tool_type from backend metadata (both workloads and vMCP)
  • ✅ Update all affected tests
  • ✅ Update API documentation (swagger.yaml) and regenerate docs

Impact

The business logic that previously checked ToolType != 'mcp' && !Remote now simplifies to just checking the Remote field directly. This makes the code cleaner and easier to understand.

Stats: 16 files changed, 9 insertions(+), 96 deletions(-)

Fixes #2923

Signed-off-by: carlos carlosgn@protonmail.com

🤖 Generated with Claude Code

Co-authored-by: Claude noreply@anthropic.com

The ToolType field in the Workload struct mapped to either "mcp"
(container workloads) or "remote" (remote workloads), but since MCP
is the only alternative type in practice, the field has become
unnecessary and adds no value.

This change eliminates the redundant field from the codebase,
simplifying the business logic that previously checked both ToolType
and Remote fields. The condition "ToolType != 'mcp' && !Remote" now
simplifies to just checking the Remote field directly.

Changes:
- Remove ToolType field from core.Workload struct
- Delete LabelToolType constant and GetToolType function from labels package
- Simplify shouldSkipWorkload logic in client manager
- Remove ToolType from CLI list command output
- Remove tool_type from backend metadata (workloads and vMCP)
- Update all affected tests
- Update API documentation (swagger.yaml) and regenerate docs

Fixes stacklok#2923

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: carlos <carlosgn@protonmail.com>
@github-actions github-actions bot added the size/S Small PR: 100-299 lines changed label Dec 6, 2025
@codecov
Copy link

codecov bot commented Dec 6, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 56.36%. Comparing base (1c07515) to head (603026f).

Files with missing lines Patch % Lines
pkg/client/manager.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2932      +/-   ##
==========================================
- Coverage   56.36%   56.36%   -0.01%     
==========================================
  Files         323      323              
  Lines       31763    31753      -10     
==========================================
- Hits        17904    17898       -6     
+ Misses      12330    12326       -4     
  Partials     1529     1529              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the redundant ToolType field from the Workload struct throughout the codebase. The field previously distinguished between "mcp" (container workloads) and "remote" (remote workloads), but since MCP is the only alternative type in practice and the Remote boolean field provides the same information, ToolType became unnecessary.

Key changes:

  • Removed ToolType field from core.Workload struct and all JSON serialization
  • Deleted LabelToolType constant and GetToolType() helper function from labels package
  • Simplified shouldSkipWorkload() logic from workload.ToolType != mcpToolType && !workload.Remote to just !workload.Remote

Reviewed changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/core/workload.go Removed ToolType field from Workload struct definition
pkg/core/workload_test.go Removed ToolType field from test workload instances and assertions
pkg/labels/labels.go Removed LabelToolType constant, GetToolType() function, and label assignment logic
pkg/labels/labels_test.go Removed LabelToolType from expected label maps and deleted TestGetToolType function
pkg/workloads/types/types.go Removed GetToolType() call and ToolType field assignment in WorkloadFromContainerInfo()
pkg/workloads/manager.go Removed ToolType from backend metadata in two locations (workload conversion and remote workload creation)
pkg/vmcp/workloads/k8s.go Removed ToolType from backend metadata and modernized code with maps.Copy()
pkg/vmcp/workloads/k8s_test.go Removed ToolType assertion from backend metadata test
pkg/vmcp/aggregator/discoverer_test.go Removed ToolType from test backend metadata definitions and assertions
pkg/client/manager.go Simplified shouldSkipWorkload() to check only !workload.Remote instead of compound condition
pkg/runner/config_test.go Removed toolhive-tool-type label from expected container labels in multiple test cases
cmd/thv/app/list.go Removed TOOL TYPE column from CLI list command output
test/e2e/remote_mcp_server_test.go Removed ToolType field from WorkloadInfo struct and test assertion
docs/server/swagger.yaml Removed tool_type field definition from core.Workload schema
docs/server/swagger.json Removed tool_type from JSON API specification (regenerated from swagger.yaml)
docs/server/docs.go Removed tool_type from Go docs template (regenerated from swagger.yaml)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@carlos-gn
Copy link
Author

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review. ✅ Project coverage is 56.36%. Comparing base (1c07515) to head (603026f).

Files with missing lines Patch % Lines
pkg/client/manager.go 0.00% 1 Missing ⚠️
Additional details and impacted files

@@            Coverage Diff             @@
##             main    #2932      +/-   ##
==========================================
- Coverage   56.36%   56.36%   -0.01%     
==========================================
  Files         323      323              
  Lines       31763    31753      -10     
==========================================
- Hits        17904    17898       -6     
+ Misses      12330    12326       -4     
  Partials     1529     1529              

☔ View full report in Codecov by Sentry. 📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:

👀 checking this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove ToolType from Workload struct and delete all references

1 participant