Skip to content

Conversation

@devantler
Copy link
Collaborator

@devantler devantler commented Jan 29, 2026

Enhancements include improved flag handling to prevent unknown flag errors and detailed logging for command execution and failures. Tests for array parameters and excluded commands were also introduced to ensure robustness.

Type of change

  • 🧹 Refactor
  • 🪲 Bug fix
  • 🚀 New feature
  • ⛓️‍💥 Breaking change
  • 📚 Documentation update

…g and logging

- Add ItemsType to FlagDef for JSON schema array items.
- Filter parameters in handleConsolidatedTool to prevent unknown flag errors.
- Implement detailed logging for command execution and failures.
- Introduce tests for array parameters and excluded commands.
- Update ToolOptions to include a logger for debug logging.

Signed-off-by: Nikolai Emil Damm <nikolaiemildamm@icloud.com>
@github-project-automation github-project-automation bot moved this to 🏃🏻‍♂️ In Progress in 🌊 Project Board Jan 29, 2026
@devantler devantler self-assigned this Jan 29, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 29, 2026

⚠️MegaLinter analysis: Success with warnings

⚠️ MARKDOWN / markdownlint - 45 errors
.github/aw/create-agentic-workflow.md:88 error MD036/no-emphasis-as-heading Emphasis used instead of a heading [Context: "Read the gh-aw instructions"]
.github/aw/create-agentic-workflow.md:248 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/aw/create-shared-agentic-workflow.md:16 error MD036/no-emphasis-as-heading Emphasis used instead of a heading [Context: "Build on agentic workflows"]
.github/aw/create-shared-agentic-workflow.md:23 error MD036/no-emphasis-as-heading Emphasis used instead of a heading [Context: "Prefer Docker Solutions"]
.github/aw/create-shared-agentic-workflow.md:30 error MD036/no-emphasis-as-heading Emphasis used instead of a heading [Context: "Support Read-Only Tools"]
.github/aw/create-shared-agentic-workflow.md:37 error MD036/no-emphasis-as-heading Emphasis used instead of a heading [Context: "Move Write Operations to Safe ..."]
.github/aw/create-shared-agentic-workflow.md:44 error MD036/no-emphasis-as-heading Emphasis used instead of a heading [Context: "Process Agent Output in Safe J..."]
.github/aw/create-shared-agentic-workflow.md:57 error MD036/no-emphasis-as-heading Emphasis used instead of a heading [Context: "Documentation"]
.github/aw/create-shared-agentic-workflow.md:67 error MD003/heading-style Heading style [Expected: atx; Actual: setext]
.github/aw/create-shared-agentic-workflow.md:70 error MD003/heading-style Heading style [Expected: atx; Actual: setext]
.github/aw/create-shared-agentic-workflow.md:306 error MD003/heading-style Heading style [Expected: atx; Actual: setext]
.github/aw/create-shared-agentic-workflow.md:310 error MD003/heading-style Heading style [Expected: atx; Actual: setext]
.github/aw/create-shared-agentic-workflow.md:411 error MD003/heading-style Heading style [Expected: atx; Actual: setext]
.github/aw/create-shared-agentic-workflow.md:415 error MD003/heading-style Heading style [Expected: atx; Actual: setext]
.github/aw/create-shared-agentic-workflow.md:442 error MD025/single-title/single-h1 Multiple top-level headings in the same document [Context: "Good - specific version"]
.github/aw/create-shared-agentic-workflow.md:447 error MD025/single-title/single-h1 Multiple top-level headings in the same document [Context: "Good - SHA for immutability"]
.github/aw/create-shared-agentic-workflow.md:452 error MD025/single-title/single-h1 Multiple top-level headings in the same document [Context: "Acceptable - latest for develo..."]
.github/aw/create-shared-agentic-workflow.md:458 error MD001/heading-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]
.github/aw/create-shared-agentic-workflow.md:462 error MD025/single-title/single-h1 Multiple top-level headings in the same document [Context: "Read-only workspace mount"]
.github/aw/create-shared-agentic-workflow.md:472 error MD001/heading-increment Heading levels should only increment by one level at a time [Expected: h2; Actual: h3]
.github/aw/create-shared-agentic-workflow.md:476 error MD025/single-title/single-h1 Multiple top-level headings in the same document [Context: "Pattern: Pass through Docker w..."]
.github/aw/debug-agentic-workflow.md:19 error MD036/no-emphasis-as-heading Emphasis used instead of a heading [Context: "Example: Debugging from a work..."]
.github/aw/debug-agentic-workflow.md:25 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/aw/debug-agentic-workflow.md:39 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/aw/debug-agentic-workflow.md:53 error MD036/no-emphasis-as-heading Emphasis used instead of a heading [Context: "Prerequisites"]
.github/aw/debug-agentic-workflow.md:60 error MD036/no-emphasis-as-heading Emphasis used instead of a heading [Context: "Key Commands Available"]
.github/aw/debug-agentic-workflow.md:91 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/aw/debug-agentic-workflow.md:124 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/aw/debug-agentic-workflow.md:162 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/aw/debug-agentic-workflow.md:199 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/aw/debug-agentic-workflow.md:208 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/aw/debug-agentic-workflow.md:218 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/aw/debug-agentic-workflow.md:256 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/aw/debug-agentic-workflow.md:468 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/aw/update-agentic-workflow.md:48 error MD036/no-emphasis-as-heading Emphasis used instead of a heading [Context: "Read the gh-aw instructions"]
.github/aw/update-agentic-workflow.md:240 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/aw/update-agentic-workflow.md:509 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/aw/upgrade-agentic-workflows.md:13 error MD036/no-emphasis-as-heading Emphasis used instead of a heading [Context: "Prerequisites"]
.github/aw/upgrade-agentic-workflows.md:20 error MD036/no-emphasis-as-heading Emphasis used instead of a heading [Context: "Key Commands Available"]
.github/aw/upgrade-agentic-workflows.md:265 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/skills/refactor/SKILL.md:37 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/skills/refactor/SKILL.md:563 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
.github/workflows/update-docs.md:152 error MD028/no-blanks-blockquote Blank line inside blockquote
docs/src/content/docs/faq.md:204 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "``````"]
pkg/svc/chat/docs/faq.md:204 error MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "``````"]

✅ Linters with no issues

actionlint, bash-exec, git_diff, hadolint, jscpd, jsonlint, lychee, markdown-table-formatter, prettier, prettier, shellcheck, shfmt, stylelint, syft, trivy-sbom, trufflehog, v8r, v8r, yamllint

See detailed reports in MegaLinter artifacts

MegaLinter is graciously provided by OX Security

@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

❌ Patch coverage is 54.32099% with 37 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/ai/toolgen/executor.go 23.80% 16 Missing ⚠️
pkg/ai/toolgen/generator.go 77.14% 6 Missing and 2 partials ⚠️
pkg/cli/setup/components.go 0.00% 6 Missing and 1 partial ⚠️
pkg/ai/toolgen/mcp.go 0.00% 5 Missing ⚠️
pkg/svc/mcp/server.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

…es; optimize component count logic

Signed-off-by: Nikolai Emil Damm <nikolaiemildamm@icloud.com>
@devantler devantler marked this pull request as ready for review January 29, 2026 18:11
Copilot AI review requested due to automatic review settings January 29, 2026 18:11
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 hardens MCP tool generation and execution by fixing JSON schema array definitions, excluding meta commands and their children from tool generation, and adding structured logging to command execution, while also tuning installer timeouts.

Changes:

  • Ensure all array-typed tool parameters include proper JSON Schema items definitions and add tests to guard against regressions, fixing MCP validation errors.
  • Improve consolidated tool handling by filtering parameters to only those applicable to the chosen subcommand and by excluding meta commands (e.g., ksail completion, ksail mcp) and their children from tool generation.
  • Wire an optional slog.Logger through MCP server and tool execution for detailed debug/error logging, and introduce a dedicated cert-manager install timeout, plus a small cleanup to component counting.

Reviewed changes

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

Show a summary per file
File Description
pkg/svc/mcp/server.go Passes the configured logger into toolgen options so MCP-executed commands emit structured debug/error logs.
pkg/svc/installer/helpers.go Adds a dedicated CertManagerInstallTimeout constant to allow cert‑manager installs extra time.
pkg/cli/setup/post_cni.go Simplifies ComponentRequirements.Count() using a boolean slice while still counting all component flags, including ArgoCD and Flux.
pkg/cli/setup/components.go Centralizes installer error variables (including CSI and policy engine) and updates the cert‑manager factory to use the new minimum timeout while keeping test expectations intact.
pkg/ai/toolgen/options.go Extends ToolOptions with an optional *slog.Logger used during command execution, keeping default options unchanged aside from the new field.
pkg/ai/toolgen/mcp.go Enhances MCP error responses to include both command output and the wrapped error (with exit code), improving diagnosability for failed tool calls.
pkg/ai/toolgen/generator.go Adds prefix-based exclusion of commands and their children (e.g., ksail completion …), introduces ItemsType for flags, and ensures consolidated-tool schemas emit array types with proper items.
pkg/ai/toolgen/definition.go Extends FlagDef with an ItemsType field so array flags can carry their element JSON Schema type into consolidated schemas.
pkg/ai/toolgen/executor.go Filters consolidated-tool parameters to only those flags defined for the selected subcommand to avoid “unknown flag” errors, and adds structured logging around command execution and failures.
pkg/ai/toolgen/generator_test.go Adds regression tests verifying all array parameters define items with allowed types and that excluded commands (chat, mcp, completion, help) and their children are not generated as tools.
pkg/ai/toolgen/executor_test.go Extends consolidated execution tests to assert that flags not applicable to the chosen subcommand are filtered out, preventing MCP-driven invocations from failing on inapplicable defaults.

…nce array parameter validation in tests

Signed-off-by: Nikolai Emil Damm <nikolaiemildamm@icloud.com>
@github-project-automation github-project-automation bot moved this from 🏃🏻‍♂️ In Progress to 🚀 In Finalization in 🌊 Project Board Jan 29, 2026
@botantler botantler bot enabled auto-merge January 29, 2026 18:48
Copilot AI review requested due to automatic review settings January 29, 2026 18:52
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@botantler botantler bot added this pull request to the merge queue Jan 29, 2026
…istency

Signed-off-by: Nikolai Emil Damm <nikolaiemildamm@icloud.com>
Signed-off-by: Nikolai Emil Damm <nikolaiemildamm@icloud.com>
@devantler devantler removed this pull request from the merge queue due to a manual request Jan 29, 2026
@botantler botantler bot enabled auto-merge January 29, 2026 19:01
@botantler botantler bot added this pull request to the merge queue Jan 29, 2026
Merged via the queue into main with commit d2816e4 Jan 29, 2026
24 checks passed
@botantler botantler bot deleted the fix/mcp-server-tool-gen branch January 29, 2026 19:22
@github-project-automation github-project-automation bot moved this from 🚀 In Finalization to ✅ Done in 🌊 Project Board Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

2 participants