feat(use-case): compose_query accepts GraphQL variables - #148
Merged
Conversation
- tool signature: variables: dict | None, forwarded to the executor; docstring teaches agents to pass string args via variables instead of inline literals (quotes/backslashes/newlines = #1 parse-error source) - executor: parse_operations(document, variables) — the plumbing already existed (QueryParser resolves $vars), only the tool layer never exposed it - friendly contract check: declared-but-missing variables fail fast with a hint instead of dying later as graphql Undefined inside argument coercion Co-Authored-By: Claude <noreply@anthropic.com>
Mechanical fixes only — unused imports removed (F401), import blocks sorted (I001), blank lines normalized. No semantic changes; full test suite passes with them. The 8 remaining ruff findings (E501/F841/E741) are manual-only and untouched. Co-Authored-By: Claude <noreply@anthropic.com>
…s note Review follow-ups to 7a72f2c: - demo GraphiQL endpoint forwards variables to execute_compose_query (the stale 400 guard predated executor support; GraphiQL's variables pane was unusable against it) - variable-default omission ($t: String = "x") appends a note naming the limitation — only when the query actually declares a default, so plain $t: String! misses keep a to-the-point message; docstrings on both the executor and the MCP tool state every declared variable must be passed explicitly - regression tests: defaulted-var error names the limitation / required- var error stays clean - changelog 6.3.0 entry - fix E501 in the new variables tests Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
MCP Layer 3
compose_query/execute_compose_query接受 GraphQLvariables——字符串参数经 variables 传入而非内联 GraphQL 字面量,规避引号/反斜杠/换行转义这一 agent 语法错误的最大来源。声明变量缺值时 fail-fast 并给出明确指路。改动
execute_compose_query新增variables参数,经既有QueryParser.parse_operations路径解析(与GraphQLHandler同一机制)variables参数;部分缺失 → 列出缺失名$t: String = "x")不支持——报错注明该限制(仅在查询确实声明默认值时附加),docstring 同步说明测试
🤖 Generated with Claude Code