Skip to content

Say what gpib_batch's steps are, so VS Code's Copilot will load it (#164) - #166

Merged
TGoodhew merged 3 commits into
mainfrom
fix/batch-steps-items-164
Oct 14, 2026
Merged

TGoodhew merged 3 commits into
mainfrom
fix/batch-steps-items-164

Conversation

@TGoodhew

@TGoodhew TGoodhew commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Fixes #164.

Problem

VS Code's Copilot (agent mode) refuses any tool whose schema has a "type": "array" without items:

Failed to validate tool mcp_gpib-mcp_gpib_batch: Error: tool parameters array type must have items.

gpib_batch's steps was a bare array, so the batch tool, which gpib_overview and BatchLoopNudge steer every sweep to, was missing in VS Code.

Changes

  • steps now has an items schema: a step object with op (required, enum set | write | query | read | complete | wait), resource, command, value (number or string), unit, as, operation, settle_ms, timeout_ms. It keeps additionalProperties: true, so keys it doesn't know are still ignored. At runtime op is still matched without regard to case.
  • sweep lists its properties: var, from, to, step, count, unit.
  • ToolArgs gains ArrayOf(items, description) and ObjectOf(description, props...), plus Prop/Required overloads that take a schema. The plain Prop/Required(name, "array", ...) now throw, so an array can't be declared without its items again.
  • instrument_reference's outputSchema: the new test found two more arrays without items, commandIndex and commands. They now have items too. (The issue thought only steps was affected.)

Tests

New ToolSchemaTests:

  • walks every tool's inputSchema and outputSchema, at any depth, and asserts each array has items
  • checks gpib_batch's step shape and op enum, and the sweep properties
  • checks that the plain helpers refuse "array"

The full suite passes: 644 + 117. I also checked the schema the built server publishes in tools/list. Not yet tried in VS Code's Copilot itself.

Also fixes McpDispatcherTests.ToolsList_ReturnsAllToolsWithSchemas, which counted 32 tools rather than 31 on a PC with GPIB_MCP_MANUALS set, because manual_search is listed then. Because ManualSearchTests sets that variable while other classes run in parallel, the test could also fail in CI. The test now clears the variable for its own call and restores it, and it shares an xUnit collection with ManualSearchTests. Passes with the variable set and with it clear.

🤖 Generated with Claude Code

Copilot refuses a tool whose schema has an array without "items", and
gpib_batch's 'steps' was a bare array (#164), so in VS Code the batch
tool was missing.

- 'steps' now has an items schema: a step object whose 'op' is one of
  set/write/query/read/complete/wait, with the keys ParsePlan reads.
  It stays open to other keys, which are ignored as before.
- 'sweep' lists its properties (var, from, to, step, count, unit).
- ToolArgs gains ArrayOf and ObjectOf, and its plain-type helpers now
  refuse "array", so an array can't be declared without its items.
- A test walks every tool's input and output schema for arrays without
  items. It found two more, in instrument_reference's output
  (commandIndex, commands), which now have items too.

Fixes #164

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 15:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The regression test excludes view-only tools that are advertised to MCP Apps-capable clients.

1 open finding
What changed in this PR

Adds complete JSON schemas so strict clients can load and use gpib_batch.

Changes:

  • Defines batch step and sweep schemas.
  • Adds reusable array/object schema helpers.
  • Adds array-item validation tests and completes output schemas.
File Description
ToolSchemaTests.cs Tests schema completeness and batch shapes.
ToolArgs.cs Adds structured schema helpers and array safeguards.
DatabaseTools.cs Defines array item schemas for command output.
BatchTools.cs Publishes detailed step and sweep schemas.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/GpibMcp.Tests/ToolSchemaTests.cs Resolved
TGoodhew and others added 2 commits October 14, 2026 09:08
ToolsList_ReturnsAllToolsWithSchemas expects 31 tools, but manual_search
is listed too whenever GPIB_MCP_MANUALS names a folder - so it failed on
a PC with a library set. ManualSearchTests also sets that variable while
other classes run in parallel, so it could fail in CI too.

The test now clears the variable for its own call and puts it back, and
it shares a collection with ManualSearchTests so the two never run at
the same time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ToListJson leaves out view-only tools unless asked, but a client that
shows views lists them and checks their schemas the same way. The
schema walk now includes them (Copilot review on #166).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TGoodhew
TGoodhew merged commit d91f2b4 into main Oct 14, 2026
1 check passed
@TGoodhew
TGoodhew deleted the fix/batch-steps-items-164 branch November 7, 2026 17:45
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.

gpib_batch: 'steps' array has no items schema — VS Code Copilot rejects the tool

2 participants