Skip to content

fix(mcp): require signalRequests/signalNames on signals and signalsLatest#292

Closed
zer0stars wants to merge 1 commit into
mainfrom
fix/mcp-signal-requests
Closed

fix(mcp): require signalRequests/signalNames on signals and signalsLatest#292
zer0stars wants to merge 1 commit into
mainfrom
fix/mcp-signal-requests

Conversation

@zer0stars
Copy link
Copy Markdown
Member

@zer0stars zer0stars commented Apr 23, 2026

Summary

  • Adds required signalRequests: [SignalAggregationRequest!]! to signals and signalNames: [String!]! to signalsLatest.
  • Adds signals: [SignalAggregationValue!]! sub-field on SignalAggregations and signals: [LatestSignal!]! sub-field on SignalCollection, populated from those arguments.
  • Fixes the existing MCP shortcut tools (telemetry_get_signals_time_series, telemetry_get_latest_signals) so callers pass signal names through arguments instead of a GraphQL selection set that the MCP wrapper cannot express.

Why

The generated MCP tools used a static selection of timestamp / lastSeen with no way to carry signal names. Since the underlying resolvers build per-signal FloatArgs from the GraphQL selection set, the shortcut tools returned empty buckets, and models commonly stuffed signal names into the filter argument (which only accepts source) and got nothing back. The segments and dailyActivity tools already work this way via SegmentSignalRequest; this mirrors that pattern on the signals tools themselves.

Changes

  • schema/base.graphqls: required signalRequests / signalNames args; new SignalAggregationRequest input; new signals sub-fields on SignalAggregations and SignalCollection; updated @mcpTool selections to timestamp signals { name agg value } and lastSeen signals { name timestamp valueNumber valueString valueLocation { ... } }.
  • internal/graph/signal_requests.go: helpers that append FloatArgs for each privileged request and populate the bucket signals list from the query result; snapshot-based filtering for the latest-by-name path.
  • internal/graph/base.resolvers.go: resolver wiring.
  • internal/graph/mcp_tools_gen.go, internal/graph/generated.go, internal/graph/model/models_gen.go, internal/graph/model/signal_aggs.go: regenerated / field added.

Breaking change

GraphQL clients of signals and signalsLatest must now supply the new required arguments. An empty list (signalRequests: [] / signalNames: []) is valid and preserves the existing selection-set aggregation behavior.

Test plan

  • make lint clean
  • make build
  • go test ./internal/...
  • Manual: call telemetry_get_signals_time_series and telemetry_get_latest_signals via /mcp against a deployed env with a real token; confirm non-empty signals in each bucket and in the latest response

…test

The MCP shortcut tools for `signals` and `signalsLatest` wrapped those
GraphQL fields with a static selection of `timestamp` / `lastSeen` only.
The underlying resolvers read signal names and aggregations from the
GraphQL selection set, so the MCP tool returned buckets with no data
and models frequently stuffed signal names into the `filter` argument
(the only shape that looked plausible).

Add required arguments that carry signal names through explicitly:

- `signals(signalRequests: [SignalAggregationRequest!]!)` where each
  entry is `{name, agg}`, and a new `signals: [SignalAggregationValue!]!`
  sub-field on `SignalAggregations` carrying one entry per supplied
  request.
- `signalsLatest(signalNames: [String!]!)` and a new
  `signals: [LatestSignal!]!` sub-field on `SignalCollection` carrying
  the latest value for each requested name, filtered by caller
  privileges.

The tool names (`get_signals_time_series`, `get_latest_signals`) and
selection-set-based aggregation paths are preserved; this is purely an
additive schema change that makes the shortcut tools usable.

Breaking change for GraphQL clients of `signals`/`signalsLatest`: the
new arguments are required (non-null), so clients must pass them (an
empty list `[]` is valid when using only selection-set aggregation).
@zer0stars zer0stars force-pushed the fix/mcp-signal-requests branch from a890ef4 to 27508a7 Compare April 23, 2026 19:30
@zer0stars zer0stars changed the title feat(mcp): named signal requests for time-series and latest tools fix(mcp): require signalRequests/signalNames on signals and signalsLatest Apr 23, 2026
@zer0stars
Copy link
Copy Markdown
Member Author

Superseded by a fix in mcpgen — DIMO-Network/server-garage#34 adds templated @mcpTool selections. Once merged + bumped here, the signals and signalsLatest tools will be fixed by swapping their selection strings to templates, with no schema changes.

@zer0stars zer0stars closed this Apr 23, 2026
@zer0stars zer0stars deleted the fix/mcp-signal-requests branch April 23, 2026 19:43
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