Skip to content

feat: get_function_definitions (release 0.2.0) - #14

Merged
marcosqlbi merged 4 commits into
mainfrom
feature/get-function-definitions
Nov 1, 2026
Merged

marcosqlbi merged 4 commits into
mainfrom
feature/get-function-definitions

Conversation

@marcosqlbi

@marcosqlbi marcosqlbi commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Implements release 0.2.0 of the DAX Lib MCP inline-functions spec: DAX Lib functions inside a DAX query (DEFINE FUNCTION ... EVALUATE ...) without changing the model.

Changes

  • New read-only tool get_function_definitions: returns a DEFINE block (embedded resource daxlib-define://<id>/<version>/define.dax) with the selected functions and their call closure, also in declared dependency packages at the exact declared versions. Inputs: id, version, functions, includeDependencies (none/package/all, default all), includeDescriptions. Never connects to a model; no compatibility-level check; no renames.
  • src/Dax.Tokenizer: the DAX lexer of sql-bi/Vpax-Obfuscator (commit 8990d0b, MIT, ANTLR 4.13.1 runtime), vendored unchanged as its own project with the upstream namespace. When the NuGet package is published, the project is replaced by a package reference (steps in src/Dax.Tokenizer/README.md).
  • QueryDefinitions/: DaxSyntax (adapter over the lexer: calls, comments, parameter names, literal spans), embedded built-in list (472 names, INFO.FUNCTIONS), FunctionCatalog (descriptions, parameters, calls), DependencyResolver (closure, warnings, complete, recursion check, per-call cache, download only when a call leaves the package), DaxQueryWriter.
  • Warnings: missingDependency, dependencyNotFound, dependencyVersionNotFound, versionConflict, functionNotFound (set complete = false); undeclaredDependency, unresolvedCall, packageCycle (information). Errors carry data.code: unknownFunction (up to 10 close names), tmdlParseFailed, recursiveCall, nameCollision.
  • install_package: warning dependencyNotInstalled when a manifest dependency has no function in the model.
  • get_package description and server instructions point to the new tool.
  • CI: matrix on windows-latest, ubuntu-latest, macos-latest; non-Windows jobs are continue-on-error (build try). RuntimeIdentifiers = win-x64;linux-x64;osx-arm64, lock files regenerated.
  • Docs: README, architecture, new docs/decisions/dependency-resolution.md, CHANGELOG; version.json = 0.2.0 (separate chore(release) commit).

Verification

  • Release build with -warnaserror, locked-mode restore: OK. 110 unit tests pass (4 opt-in live tests skipped).
  • Call graph with the vendored lexer: all 64 published packages match the golden data (300 edges; PQL.Assert has since published 18 more functions, none with calls); XU.Calendar.About has no false edges.
  • DaxLib.Sample block equals T02 (whitespace aside), 497 characters. Viz.Pill + Viz.ProgressBar closure: 9 functions, 16,454 characters.
  • Gallery live test (DAXLIB_MCP_LIVE_GALLERY_TESTS=1): every latest package returns a block. Stdio smoke test of the built executable against the live gallery: OK.
  • Not run yet: Power BI service smoke test (needs DAXLIB_MCP_PBI_WORKSPACE_ID, DAXLIB_MCP_PBI_DATASET_ID, DAXLIB_MCP_PBI_ACCESS_TOKEN; expects 62 of 64 to run, known failures DaxLib.SVG and Ankush.SemanticInfo); Linux/macOS CI (this PR).

Notes for review

  • data.code on errors is new for this tool; the other tools return only a message.
  • unresolvedCall is reported only for dotted names, so keywords such as RETURN ( do not warn.
  • Lines that continue a multi-line string literal are not re-indented, so string values never change.
  • The chore(release): prepare 0.2.0 commit may need to move to its own release branch per docs/release-process.md.

🤖 Generated with Claude Code

marcosqlbi and others added 4 commits October 24, 2026 00:25
New read-only tool get_function_definitions returns a DEFINE block with
the selected functions of a package and their call closure, also in the
declared dependency packages at the exact declared versions. Call
detection uses a tokenizer; problems are reported as warnings with a
`complete` flag, recursion as an error. The tool never connects to a
model. Names and code are returned as published.

install_package now warns (dependencyNotInstalled) when a manifest
dependency has no function in the model. get_package points to the new
tool. CI also builds and tests on Linux and macOS as a non-blocking try.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the hand-written tokenizer with Dax.Tokenizer from
sql-bi/Vpax-Obfuscator (commit 8990d0b, MIT), an ANTLR-generated DAX
lexer. The source is vendored unchanged in src/Dax.Tokenizer as its own
project with the upstream namespace, so it can be replaced by the NuGet
package with a reference change (see src/Dax.Tokenizer/README.md).

QueryDefinitions/DaxSyntax adapts the lexer for call detection,
parameter parsing (keyword tokens such as `text` or `year` are accepted
as parameter names) and the literal spans the DEFINE writer must not
re-indent. Call graphs of all 64 published packages still match the
golden data (300 edges).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The executable now bundles the ANTLR 4 C# runtime (BSD-3-Clause). The
release workflow copies THIRD-PARTY-NOTICES.md into the win32-x64 npm
package, next to the executable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@marcosqlbi
marcosqlbi marked this pull request as ready for review November 1, 2026 17:21
@marcosqlbi
marcosqlbi merged commit ea6cabe into main Nov 1, 2026
3 checks passed
@marcosqlbi
marcosqlbi deleted the feature/get-function-definitions branch November 1, 2026 17:23
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