Skip to content

feat(mcpserver): executor options + strict selection template keys#38

Merged
zer0stars merged 2 commits into
mainfrom
feat/mcp-executor-options
Jun 12, 2026
Merged

feat(mcpserver): executor options + strict selection template keys#38
zer0stars merged 2 commits into
mainfrom
feat/mcp-executor-options

Conversation

@zer0stars

Copy link
Copy Markdown
Member

Why

NewGQLGenExecutor builds a bare executor.New(es) — none of the gqlgen handler extensions a service registers on its HTTP GraphQL server (server.Use) apply on the MCP path. In telemetry-api that means MCP tool calls bypass DCX credit tracking, complexity limits, query recording, and the error presenter.

What

  • ExecutorOption: NewGQLGenExecutor(es, opts ...ExecutorOption) — variadic, source-compatible. Callers get the underlying *executor.Executor to register extensions / set an error presenter, so HTTP and MCP paths behave identically.
  • missingkey=error on SelectionTemplate parsing: a tool call omitting a templated key (e.g. a signalRequests entry without agg) now returns a clear render error instead of splicing <no value> into the executed GraphQL query.

Testing

  • TestGQLGenExecutorAppliesOptions — extension registered via option intercepts responses.
  • TestSelectionTemplateMissingKeyReturnsToolError — missing key surfaces as tool error, executor never called.
  • Full suite + lint pass.

Follow-up: telemetry-api PR DIMO-Network/telemetry-api#300 wires its extension set into the MCP executor using this.

🤖 Generated with Claude Code

NewGQLGenExecutor now accepts ExecutorOption funcs so services can
register gqlgen handler extensions (billing, complexity limits, query
recording) and error presenters on the MCP executor path — previously
the bare executor silently bypassed everything configured on the HTTP
GraphQL server via server.Use.

SelectionTemplate now parses with missingkey=error so a call omitting a
templated key gets a clear render error instead of '<no value>' spliced
into the executed GraphQL query.
zer0stars added a commit to DIMO-Network/telemetry-api that referenced this pull request Jun 12, 2026
The MCP path used a bare executor, bypassing everything registered on
the HTTP GraphQL server: DCX credit tracking, complexity limit, query
recording, metrics, and the error presenter. With the shortcut tools now
returning real data, that gap meant unbilled, unrecorded, uncapped
signal access over MCP.

configureGQLExtensions holds the single shared extension list and is
applied to both *handler.Server and *executor.Executor (via the new
server-garage ExecutorOption hook).

server-garage is pinned to a pre-release commit of
DIMO-Network/server-garage#38; bump to the tagged release once it
lands.
The unpinned 'latest' install pulled v2.12.2, whose release artifact
fails the installer's sha256 verification, breaking every CI run. Pin
the version and fetch install.sh from the version tag, matching the
telemetry-api Makefile convention.
@zer0stars
zer0stars merged commit 32bd508 into main Jun 12, 2026
4 checks passed
@zer0stars
zer0stars deleted the feat/mcp-executor-options branch June 12, 2026 02:00
zer0stars added a commit to DIMO-Network/telemetry-api that referenced this pull request Jun 12, 2026
…tions (#300)

* fix(mcp): make signals shortcut tools return data via templated selections

telemetry_get_signals_time_series and telemetry_get_latest_signals
selected only timestamp/lastSeen because mcpgen cannot express
field-selection arguments, so both returned empty data.

Override the two ToolDefinitions at startup using server-garage v0.3.0
SelectionTemplate + ToolOnly args: the model passes a signal list to
the tool, the selection set is rendered at call time, and the GraphQL
schema stays untouched.

* fix(mcp): fail startup when override targets missing from generated tools

OverrideMCPTools now returns an error if either expected tool name is
absent, so an mcpgen rename breaks startup instead of silently shipping
the original empty-selection tools. Tests cover patching, input
immutability, the missing-tool error, and that rendered templates parse
as valid GraphQL.

* fix(mcp): apply shared gqlgen extensions to MCP executor

The MCP path used a bare executor, bypassing everything registered on
the HTTP GraphQL server: DCX credit tracking, complexity limit, query
recording, metrics, and the error presenter. With the shortcut tools now
returning real data, that gap meant unbilled, unrecorded, uncapped
signal access over MCP.

configureGQLExtensions holds the single shared extension list and is
applied to both *handler.Server and *executor.Executor (via the new
server-garage ExecutorOption hook).

server-garage is pinned to a pre-release commit of
DIMO-Network/server-garage#38; bump to the tagged release once it
lands.

* chore: bump server-garage to v0.4.0
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