Skip to content

feat(mcp): advertise output schemas for data tools + bump to v1.22#65

Merged
felixgeelhaar merged 1 commit into
mainfrom
feat/mcp-structured-output
Jul 10, 2026
Merged

feat(mcp): advertise output schemas for data tools + bump to v1.22#65
felixgeelhaar merged 1 commit into
mainfrom
feat/mcp-structured-output

Conversation

@felixgeelhaar

Copy link
Copy Markdown
Collaborator

What

Adopts mcp-go structured content for scout's fixed-schema data tools. Each converted tool now emits typed `structuredContent` alongside its JSON text block via `ToolBuilder.OutputSchema`, following the in-repo precedent already set by `observe`, `network_summary`, and `aria_violations`.

Folds in the pending mcp bump v1.21 -> v1.22 — supersedes #64. Built clean, no auth usage.

Tools converted

Object-returning tools (added `.OutputSchema(T{})`, no behavior change — they already returned typed structs):

Tool Output type
`network_requests` `NetworkRequestsResult`
`web_vitals` `agent.WebVitalsResult`
`console_errors` `agent.DiagnosticsResult`
`check_readiness` `agent.PageReadiness`
`discover_form` `agent.FormDiscoveryResult`

Bare-slice tools wrapped in a fixed `{items, total}` object envelope (structuredContent must be a JSON object, not a bare array — each element is a fixed-shape struct):

Tool Envelope Element type
`failed_requests` `FailedRequestsResult` `agent.NetworkFailure`
`list_tabs` `ListTabsResult` `agent.TabInfo`
`cookies_list` `CookiesListResult` `agent.CookieInfo`

Already advertised (left untouched): `network_summary`, `aria_violations`.

Intentionally skipped — cannot honor a fixed schema

  • `accessibility_tree` — returns a plain `string` (compact text tree), not a JSON object; nothing fixed to advertise.
  • `component_state`, `app_state` — return `map[string]any`; the shape is framework/page-dependent, so a fixed OutputSchema would be a contract scout can't keep.
  • Dynamic-extraction tools (`extract`, `extract_all`, `auto_extract`, `markdown`, `readable_text`, `observe*`, `scroll_and_collect`) and all browser-action / mutation tools — out of scope; their output depends on the page/selector.

Guard test

Adds `TestOutputSchemasGenerate` (`cmd/scout/mcp_outputschema_test.go`): calls `schema.Generate` for every advertised output type. `OutputSchema` runs `schema.Generate` at registration and silently drops the tool if it errors — this test fails loudly in CI instead, so a type that becomes unrepresentable is caught rather than silently removing a production tool.

Verification

  • `gofmt -l` on changed files: clean
  • `go build ./...`: exit 0
  • `go vet ./...`: clean
  • `go test ./... -count=1`: all pass
  • `golangci-lint run ./cmd/scout/`: 0 issues

https://claude.ai/code/session_01LCyhyAffdzBmzG3yPPqzTT

Adopt mcp-go structured content for fixed-schema data tools. Each converted
tool now emits typed structuredContent alongside its JSON text block via
ToolBuilder.OutputSchema, following the in-repo precedent set by observe /
network_summary / aria_violations.

Object-returning tools (schema added, no behavior change):
- network_requests, web_vitals, console_errors, check_readiness, discover_form

Bare-slice tools wrapped in a fixed {items,total} object envelope (a JSON
object is required for structuredContent):
- failed_requests, list_tabs, cookies_list

Intentionally skipped (cannot honor a fixed schema):
- accessibility_tree: returns a plain string, not an object
- component_state, app_state: return map[string]any (framework/page-dependent)
- all dynamic-extraction and browser-action tools (out of scope)

Folds in the pending mcp v1.18->v1.22 bump (supersedes #64).

Adds TestOutputSchemasGenerate: calls schema.Generate for every advertised
output type so a type that becomes unrepresentable fails CI instead of
silently dropping the tool at registration.

Claude-Session: https://claude.ai/code/session_01LCyhyAffdzBmzG3yPPqzTT
@felixgeelhaar
felixgeelhaar enabled auto-merge (squash) July 10, 2026 21:01
@felixgeelhaar
felixgeelhaar merged commit 550c77a into main Jul 10, 2026
7 checks passed
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.

1 participant