Skip to content

fix(mcp): quote identifiers in DESCRIBE METHOD for host-native relations - #927

Merged
jeffreyaven merged 1 commit into
stackql:mainfrom
Sanjays2402:fix-describe-method-keyword-names
Nov 16, 2026
Merged

jeffreyaven merged 1 commit into
stackql:mainfrom
Sanjays2402:fix-describe-method-keyword-names

Conversation

@Sanjays2402

@Sanjays2402 Sanjays2402 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

describe_method could not describe a method named list. The host-native branch of GetDescribeMethod built the DESCRIBE METHOD statement by concatenating the identifiers unquoted, and list lexes as a keyword, so the parser rejected it:

DESCRIBE METHOD EXTENDED stackql_preview.google.buckets.list
syntax error at position 61 near 'list'

Passing the name double-quoted worked, which pointed at the statement rather than the method itself. The fix quotes each segment of that statement (doubling an embedded quote so a name cannot escape the identifier). The quoted statement parses, and the parsed method still resolves to list downstream.

The document-backed path was already fixed by #909 and is untouched.

Type of change

  • Bug fix (non-breaking change to fix a bug).
  • Feature (non-breaking change to add functionality).
  • Breaking change.
  • Other (eg: documentation change). Please explain.

Issues referenced.

Fixes #926

Evidence

  • New TestDescribeMethodQuotesKeywordMethodNames in internal/stackql/mcpbackend/method_schema_test.go: the generated statement for method list parses and yields method list, and a name carrying a quote stays inside its quoted identifier. go test ./internal/stackql/mcpbackend/ passes.
  • Added one robot scenario to test/robot/functional/stackql_method_schema.robot (MCP Describe Method Accepts Keyword Named Method), using the mock provider's existing list method. Ran the whole file locally against a built binary: 6 passed, 0 failed.

Checklist:

  • A full round of testing has been completed, and there are no test failures as a result of these changes.
  • The changes are covered with functional and/or integration robot testing.
  • The changes work on all supported platforms.
  • Unit tests pass locally, as per the developer guide.
  • Robot tests pass locally, as per the developer guide.
  • Linter passes locally, as per the developer guide.

Variations

Testing was scoped to the affected packages rather than a full round: the mcpbackend unit tests and the stackql_method_schema robot file, both passing. The linter was not run locally for this change, and the change was verified on Linux only, so the platforms box is unchecked.

Tech Debt

No technical debt results from this change set. Note the remaining shell-side half of #926: a DESCRIBE METHOD ... list statement typed in the shell still fails to parse, because the grammar itself rejects the keyword in that position. That needs the parser-side change in stackql-parser (accepting LIST and friends as identifiers), which is a separate repository, so it is out of scope here.

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 functional scenario uses the unchanged widgets branch, leaving the new stackql_preview quoting behavior without black-box regression coverage beyond the parser-only unit test.

1 open issue
What changed in this PR

Fixes MCP describe_method SQL generation for keyword-named methods such as list on host-native relations. This complements #909’s document-backed fix; shell parser changes remain out of scope.

Changes:

  • Quotes every identifier segment and escapes embedded double quotes.
  • Adds unit coverage for keyword method names and embedded quotes.
  • Adds a robot scenario describing the mock provider’s list method.
File Description
test/​robot/​functional/​stackql_method_schema.robot Registers the keyword-named method scenario.
test/​robot/​functional/​MethodSchemaLibrary.py Implements the MCP call and schema assertions.
internal/​stackql/​mcpbackend/​method_schema_test.go Checks parsing and keyword method-name preservation.
internal/​stackql/​mcpbackend/​mcp_service_stackql.go Quotes host-native DESCRIBE METHOD identifiers.

Review effort: Balanced

return message
request(1, "initialize", {"protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "schema-test", "version": "1"}})
process.stdin.write(b'{"jsonrpc":"2.0","method":"notifications/initialized"}\n')
args = {"provider": "widgets", "service": "things", "resource": "widgets", "method": "list", "format": "json"}
@jeffreyaven
jeffreyaven merged commit b11f3e0 into stackql:main Nov 16, 2026
33 checks passed
@jeffreyaven jeffreyaven mentioned this pull request Nov 16, 2026
4 of 10 tasks
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.

[BUG] MCP describe_method fails for methods named list: DESCRIBE METHOD cannot parse a keyword method name

3 participants