Skip to content

feat: enhance logging and input validation across tools; update README - #14

Merged
onlyexeption merged 2 commits into
ibarakov/palette-recolor-guidancefrom
mstoyanova/optimizations
Oct 22, 2026
Merged

onlyexeption merged 2 commits into
ibarakov/palette-recolor-guidancefrom
mstoyanova/optimizations

Conversation

@Marina-L-Stoyanova

Copy link
Copy Markdown
Contributor

C#-only changes in server/; src/ and ThemeTools.cs are untouched.

  • --debug log under parallel calls: ToolLog.Write now locks around the append. Before, concurrent calls collided and the error was swallowed, so entries went missing.
  • stderr noise: the default log level is now Warning, and Information only with --debug. The "ready (data: …)" line is unchanged.
  • Input limits:
    • limit is clamped to 1–50, so limit: 0 or a negative value no longer returns "no results".
    • New shared helper ToolInput.CheckLength(name, value, max, min) returns isError with a clear message (e.g. "query is too long (700 characters), max 128 characters").
    • It's applied to every string parameter that declares length limits in ComponentTools, SearchTools and DocsTools, and it runs before any searching. It's ready to reuse in ThemeTools.cs.
  • Headings: tool output now starts with ## instead of #, and the sections below it moved down one level (### Properties, #### Example 1, …). ThemeTools.cs still uses # until it gets the same change.
  • search_wpf_docs(control: "ThemeManager"): control-name matching now ignores spaces as well as hyphens, so it finds the 10 "IG Theme Manager" topics.
  • READMEs: the Troubleshooting entry for --debug now mentions the SDK's stderr logging.

Tests

New IS_DOTNET checks in scripts/smoke-test.ts:

  • limit: 0 returns one result
  • an over-long query and a blank query both return isError
  • control: "ThemeManager" finds the "IG Theme Manager" topics
  • stderr has no info: lines without --debug
  • 20 parallel calls give 20 --debug log entries

@Marina-L-Stoyanova
Marina-L-Stoyanova requested review from onlyexeption and a balanced review from Copilot and removed request for onlyexeption October 20, 2026 08:39

Copilot AI 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.

🟢 Approval recommended

The focused changes have no identified blocking issues in static review; runtime tests were not executed.

No open issues 🎉

What changed in this PR

Improves reliability, input validation, and output formatting in the C# WPF MCP server while leaving the TypeScript runtime unchanged.

Changes:

  • Serializes debug-log writes and reduces default stderr logging.
  • Enforces input limits, adjusts headings, and improves documentation control matching.
  • Adds C# smoke checks and updates troubleshooting guidance.
File Description
server/​Tools/​ToolLog.cs Serializes concurrent log appends.
server/​Tools/​ToolInput.cs Adds shared string-length validation.
server/​Tools/​SearchTools.cs Validates queries, clamps limits, and adjusts headings.
server/​Tools/​DocsTools.cs Validates inputs and improves matching and headings.
server/​Tools/​ComponentTools.cs Validates inputs and adjusts headings.
server/​README.md Documents SDK debug logging.
server/​Program.cs Sets logging verbosity based on --debug.
scripts/​smoke-test.ts Adds validation and logging regression checks.
README.md Updates debug troubleshooting guidance.

Review effort: Balanced

@onlyexeption
onlyexeption changed the base branch from main to ibarakov/palette-recolor-guidance October 22, 2026 07:16
@onlyexeption
onlyexeption merged commit f2c681a into ibarakov/palette-recolor-guidance Oct 22, 2026
@onlyexeption
onlyexeption deleted the mstoyanova/optimizations branch October 22, 2026 07:23
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.

3 participants