Get desktop application:
View/edit binary Protocol Buffers messages
Service for built-in functionality.
Sends a ping request.
Lists available methods.
Message for list method request arguments. Empty message.
empty
(message has no fields)
Message for list method response.
List of available method names.
Service for KCL VM interactions.
/ Ping KclvmService, return the same value as the parameter / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "Ping", / "params": { / "value": "hello" / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "value": "hello" / }, / "id": 1 / } / ```
/ GetVersion KclvmService, return the kclvm service version information / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "GetVersion", / "params": {}, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "version": "0.9.1", / "checksum": "c020ab3eb4b9179219d6837a57f5d323", / "git_sha": "1a9a72942fffc9f62cb8f1ae4e1d5ca32aa1f399", / "version_info": "Version: 0.9.1-c020ab3eb4b9179219d6837a57f5d323\nPlatform: aarch64-apple-darwin\nGitCommit: 1a9a72942fffc9f62cb8f1ae4e1d5ca32aa1f399" / }, / "id": 1 / } / ```
Message for version request arguments. Empty message.
empty
(message has no fields)
Message for version response.
KCL version.
Checksum of the KCL version.
Git Git SHA of the KCL code repo.
Detailed version information as a string.
/ Parse KCL program with entry files. / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "ParseProgram", / "params": { / "paths": ["./src/testdata/test.k"] / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "ast_json": "{...}", / "paths": ["./src/testdata/test.k"], / "errors": [] / }, / "id": 1 / } / ```
Message for parse program response.
Abstract Syntax Tree (AST) in JSON format.
Returns the files in the order they should be compiled.
List of parse errors.
/ Parse KCL single file to Module AST JSON string with import dependencies / and parse errors. / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "ParseFile", / "params": { / "path": "./src/testdata/parse/main.k" / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "ast_json": "{...}", / "deps": ["./dep1", "./dep2"], / "errors": [] / }, / "id": 1 / } / ```
Message for parse file request arguments.
Path of the file to be parsed.
Source code to be parsed.
External packages path.
Message for parse file response.
Abstract Syntax Tree (AST) in JSON format.
File dependency paths.
List of parse errors.
/ load_package provides users with the ability to parse kcl program and semantic model / information including symbols, types, definitions, etc. / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "LoadPackage", / "params": { / "parse_args": { / "paths": ["./src/testdata/parse/main.k"] / }, / "resolve_ast": true / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "program": "{...}", / "paths": ["./src/testdata/parse/main.k"], / "parse_errors": [], / "type_errors": [], / "symbols": { ... }, / "scopes": { ... }, / "node_symbol_map": { ... }, / "symbol_node_map": { ... }, / "fully_qualified_name_map": { ... }, / "pkg_scope_map": { ... } / }, / "id": 1 / } / ```
Message for load package request arguments.
Arguments for parsing the program.
Flag indicating whether to resolve AST.
Flag indicating whether to load built-in modules.
Flag indicating whether to include AST index.
Message for load package response.
Program Abstract Syntax Tree (AST) in JSON format.
Returns the files in the order they should be compiled.
List of parse errors.
List of type errors.
Map of scopes with scope index as key.
Map of symbols with symbol index as key.
Map of node-symbol associations with AST index UUID as key.
Map of symbol-node associations with symbol index as key.
Map of fully qualified names with symbol index as key.
Map of package scope with package path as key.
/ list_options provides users with the ability to parse kcl program and get all option information. / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "ListOptions", / "params": { / "paths": ["./src/testdata/option/main.k"] / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "options": [ / { "name": "option1", "type": "str", "required": true, "default_value": "", "help": "option 1 help" }, / { "name": "option2", "type": "int", "required": false, "default_value": "0", "help": "option 2 help" }, / { "name": "option3", "type": "bool", "required": false, "default_value": "false", "help": "option 3 help" } / ] / }, / "id": 1 / } / ```
Message for list options response.
List of available options.
/ list_variables provides users with the ability to parse kcl program and get all variables by specs. / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "ListVariables", / "params": { / "files": ["./src/testdata/variables/main.k"], / "specs": ["a"] / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "variables": { / "a": { / "variables": [ / { "value": "1", "type_name": "int", "op_sym": "", "list_items": [], "dict_entries": [] } / ] / } / }, / "unsupported_codes": [], / "parse_errors": [] / }, / "id": 1 / } / ```
Message for list variables request arguments.
Files to be processed.
Specifications for variables.
Options for listing variables.
Message for list variables response.
Map of variable lists by file.
List of unsupported codes.
List of parse errors encountered.
/ Execute KCL file with args. **Note that it is not thread safe.** / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "ExecProgram", / "params": { / "work_dir": "./src/testdata", / "k_filename_list": ["test.k"] / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "json_result": "{\"alice\": {\"age\": 18}}", / "yaml_result": "alice:\n age: 18", / "log_message": "", / "err_message": "" / }, / "id": 1 / } / / // Request with code / { / "jsonrpc": "2.0", / "method": "ExecProgram", / "params": { / "k_filename_list": ["file.k"], / "k_code_list": ["alice = {age = 18}"] / }, / "id": 2 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "json_result": "{\"alice\": {\"age\": 18}}", / "yaml_result": "alice:\n age: 18", / "log_message": "", / "err_message": "" / }, / "id": 2 / } / / // Error case - cannot find file / { / "jsonrpc": "2.0", / "method": "ExecProgram", / "params": { / "k_filename_list": ["invalid_file.k"] / }, / "id": 3 / } / / // Error Response / { / "jsonrpc": "2.0", / "error": { / "code": -32602, / "message": "Cannot find the kcl file" / }, / "id": 3 / } / / // Error case - no input files / { / "jsonrpc": "2.0", / "method": "ExecProgram", / "params": { / "k_filename_list": [] / }, / "id": 4 / } / / // Error Response / { / "jsonrpc": "2.0", / "error": { / "code": -32602, / "message": "No input KCL files or paths" / }, / "id": 4 / } / ```
/ Build the KCL program to an artifact. / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "BuildProgram", / "params": { / "exec_args": { / "work_dir": "./src/testdata", / "k_filename_list": ["test.k"] / }, / "output": "./build" / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "path": "./build/test.k" / }, / "id": 1 / } / ```
Message for build program request arguments.
Arguments for executing the program.
Output path.
Message for build program response.
Path of the built program.
/ Execute the KCL artifact with args. **Note that it is not thread safe.** / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "ExecArtifact", / "params": { / "path": "./artifact_path", / "exec_args": { / "work_dir": "./src/testdata", / "k_filename_list": ["test.k"] / } / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "json_result": "{\"alice\": {\"age\": 18}}", / "yaml_result": "alice:\n age: 18", / "log_message": "", / "err_message": "" / }, / "id": 1 / } / ```
Message for execute artifact request arguments.
Path of the artifact.
Arguments for executing the program.
/ Override KCL file with args. / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "OverrideFile", / "params": { / "file": "./src/testdata/test.k", / "specs": ["alice.age=18"] / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "result": true, / "parse_errors": [] / }, / "id": 1 / } / ```
Message for override file request arguments.
Path of the file to override.
List of override specifications.
List of import paths.
Message for override file response.
Result of the override operation.
List of parse errors encountered.
/ Get schema type mapping. / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "GetSchemaTypeMapping", / "params": { / "exec_args": { / "work_dir": "./src/testdata", / "k_filename_list": ["main.k"], / "external_pkgs": [ / { / "pkg_name":"pkg", / "pkg_path": "./src/testdata/pkg" / } / ] / }, / "schema_name": "Person" / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "schema_type_mapping": { / "Person": { / "type": "schema", / "schema_name": "Person", / "properties": { / "name": { "type": "str" }, / "age": { "type": "int" } / }, / "required": ["name", "age"], / "decorators": [] / } / } / }, / "id": 1 / } / ```
Message for get schema type mapping request arguments.
Arguments for executing the program.
Name of the schema.
Message for get schema type mapping response.
Map of schema type mappings.
/ Format code source. / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "FormatCode", / "params": { / "source": "schema Person {\n name: str\n age: int\n}\nperson = Person {\n name = \"Alice\"\n age = 18\n}\n" / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "formatted": "schema Person {\n name: str\n age: int\n}\nperson = Person {\n name = \"Alice\"\n age = 18\n}\n" / }, / "id": 1 / } / ```
Message for format code request arguments.
Source code to be formatted.
Message for format code response.
Formatted code as bytes.
/ Format KCL file or directory path contains KCL files and returns the changed file paths. / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "FormatPath", / "params": { / "path": "./src/testdata/test.k" / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "changed_paths": [] / }, / "id": 1 / } / ```
Message for format file path request arguments.
Path of the file to format.
Message for format file path response.
List of changed file paths.
/ Lint files and return error messages including errors and warnings. / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "LintPath", / "params": { / "paths": ["./src/testdata/test-lint.k"] / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "results": ["Module 'math' imported but unused"] / }, / "id": 1 / } / ```
Message for lint file path request arguments.
Paths of the files to lint.
Message for lint file path response.
List of lint results.
/ Validate code using schema and data strings. / / **Note that it is not thread safe.** / / # Examples / / ```jsonrpc / // Request / { / "jsonrpc": "2.0", / "method": "ValidateCode", / "params": { / "code": "schema Person {\n name: str\n age: int\n check: 0 < age < 120\n}", / "data": "{\"name\": \"Alice\", \"age\": 10}" / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "success": true, / "err_message": "" / }, / "id": 1 / } / ```
Message for validate code request arguments.
Path to the data file.
Data content.
Path to the code file.
Source code content.
Name of the schema.
Name of the attribute.
Format of the validation (e.g., "json", "yaml").
List of external packages updated.
Message for validate code response.
Flag indicating if validation was successful.
Error message from validation.
Message for list dependency files request arguments.
Working directory.
Flag to use absolute paths.
Flag to include all files.
Flag to use fast parser.
Message for list dependency files response.
Root package path.
Package path.
List of file paths in the package.
/ Build setting file config from args. / / # Examples / / / // Request / { / "jsonrpc": "2.0", / "method": "LoadSettingsFiles", / "params": { / "work_dir": "./src/testdata/settings", / "files": ["./src/testdata/settings/kcl.yaml"] / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "kcl_cli_configs": { / "files": ["./src/testdata/settings/kcl.yaml"], / "output": "", / "overrides": [], / "path_selector": [], / "strict_range_check": false, / "disable_none": false, / "verbose": 0, / "debug": false, / "sort_keys": false, / "show_hidden": false, / "include_schema_type_path": false, / "fast_eval": false / }, / "kcl_options": [] / }, / "id": 1 / } / ```
Message for load settings files request arguments.
Working directory.
Setting files to load.
Message for load settings files response.
KCL CLI configuration.
List of KCL options as key-value pairs.
/ Rename all the occurrences of the target symbol in the files. This API will rewrite files if they contain symbols to be renamed. / Return the file paths that got changed. / / # Examples / / / // Request / { / "jsonrpc": "2.0", / "method": "Rename", / "params": { / "package_root": "./src/testdata/rename_doc", / "symbol_path": "a", / "file_paths": ["./src/testdata/rename_doc/main.k"], / "new_name": "a2" / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "changed_files": ["./src/testdata/rename_doc/main.k"] / }, / "id": 1 / } / ```
Message for rename request arguments.
File path to the package root.
Path to the target symbol to be renamed.
Paths to the source code files.
New name of the symbol.
Message for rename response.
List of file paths that got changed.
/ Rename all the occurrences of the target symbol and return the modified code if any code has been changed. This API won't rewrite files but return the changed code. / / # Examples / / / // Request / { / "jsonrpc": "2.0", / "method": "RenameCode", / "params": { / "package_root": "/mock/path", / "symbol_path": "a", / "source_codes": { / "/mock/path/main.k": "a = 1\nb = a" / }, / "new_name": "a2" / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "changed_codes": { / "/mock/path/main.k": "a2 = 1\nb = a2" / } / }, / "id": 1 / } / ```
Message for rename code request arguments.
File path to the package root.
Path to the target symbol to be renamed.
Map of source code with filename as key and code as value.
New name of the symbol.
Message for rename code response.
Map of changed code with filename as key and modified code as value.
/ Test KCL packages with test arguments. / / # Examples / / / // Request / { / "jsonrpc": "2.0", / "method": "Test", / "params": { / "exec_args": { / "work_dir": "./src/testdata/testing/module", / "k_filename_list": ["main.k"] / }, / "pkg_list": ["./src/testdata/testing/module/..."] / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "info": [ / {"name": "test_case_1", "error": "", "duration": 1000, "log_message": ""}, / {"name": "test_case_2", "error": "some error", "duration": 2000, "log_message": ""} / ] / }, / "id": 1 / } / ```
Message for test request arguments.
Execution program arguments.
List of KCL package paths to be tested.
Regular expression for filtering tests to run.
Flag to stop the test run on the first failure.
Message for test response.
List of test case information.
/ Download and update dependencies defined in the kcl.mod file. / / # Examples / / / // Request / { / "jsonrpc": "2.0", / "method": "UpdateDependencies", / "params": { / "manifest_path": "./src/testdata/update_dependencies" / }, / "id": 1 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "external_pkgs": [ / {"pkg_name": "pkg1", "pkg_path": "./src/testdata/update_dependencies/pkg1"} / ] / }, / "id": 1 / } / / // Request with vendor flag / { / "jsonrpc": "2.0", / "method": "UpdateDependencies", / "params": { / "manifest_path": "./src/testdata/update_dependencies", / "vendor": true / }, / "id": 2 / } / / // Response / { / "jsonrpc": "2.0", / "result": { / "external_pkgs": [ / {"pkg_name": "pkg1", "pkg_path": "./src/testdata/update_dependencies/pkg1"} / ] / }, / "id": 2 / } / ```
Message for update dependencies request arguments.
Path to the manifest file.
Flag to vendor dependencies locally.
Message for update dependencies response.
List of external packages updated.
Message representing a key-value argument for KCL. kcl main.k -D name=value
Used in:
Name of the argument.
Value of the argument.
Message representing KCL CLI configuration.
Used in:
List of files.
Output path.
List of overrides.
Path selectors.
Flag for strict range check.
Flag to disable none values.
Verbose level.
Debug flag.
Flag to sort keys in YAML/JSON results.
Flag to show hidden attributes.
Flag to include schema type path in results.
Flag for fast evaluation.
Message representing a decorator in KCL.
Used in:
Name of the decorator.
Arguments for the decorator.
Keyword arguments for the decorator as a map with keyword name as key.
Message representing an error.
Used in:
, , , ,Level of the error (e.g., "Error", "Warning").
Error code. (e.g., "E1001")
List of error messages.
Message representing an example in KCL.
Used in:
Short description for the example.
Long description for the example.
Embedded literal example.
Message for execute program request arguments.
Used as request type in: KclvmService.ExecProgram
Used as field type in:
, , ,Working directory.
List of KCL filenames.
List of KCL codes.
Arguments for the program.
Override configurations.
Flag to disable YAML result.
Flag to print override AST.
Flag for strict range check.
Flag to disable none values.
Verbose level.
Debug level.
Flag to sort keys in YAML/JSON results.
External packages path.
Flag to include schema type path in results.
Flag to compile only without execution.
Flag to show hidden attributes.
Path selectors for results.
Flag for fast evaluation.
Message for execute program response.
Used as response type in: KclvmService.ExecArtifact, KclvmService.ExecProgram
Result in JSON format.
Result in YAML format.
Log message from execution.
Error message from execution.
Message representing an external package for KCL. kcl main.k -E pkg_name=pkg_path
Used in:
, , , ,Name of the package.
Path of the package.
Message for get schema type mapping response.
Map of pkg and schema types mappings.
Message representing a KCL type.
Used in:
, ,Type name (e.g., schema, dict, list, str, int, float, bool, any, union, number_multiplier).
Union types if applicable.
Default value of the type.
Name of the schema if applicable.
Documentation for the schema.
Properties of the schema as a map with property name as key.
List of required schema properties.
Key type if the KclType is a dictionary.
Item type if the KclType is a list or dictionary.
Line number where the type is defined.
List of decorators for the schema.
Absolute path of the file where the attribute is located.
Path of the package where the attribute is located.
Documentation for the attribute.
Map of examples with example name as key.
Base schema if applicable.
Message representing a key-value pair.
Used in:
Key of the pair.
Value of the pair.
Message for list variables options.
Used in:
Flag to merge program configuration.
Message representing a map entry.
Used in:
Key of the map entry.
Value of the map entry.
Message representing a detailed error message with a position.
Used in:
The error message text.
The position in the source code where the error occurred.
Message representing a help option.
Used in:
Name of the option.
Type of the option.
Flag indicating if the option is required.
Default value of the option.
Help text for the option.
Message for parse program request arguments.
Used as request type in: KclvmService.ListOptions, KclvmService.ParseProgram
Used as field type in:
Paths of the program files to be parsed.
Source codes to be parsed.
External packages path.
Message for ping request arguments.
Used as request type in: BuiltinService.Ping, KclvmService.Ping
Value to be sent in the ping request.
Message for ping response.
Used as response type in: BuiltinService.Ping, KclvmService.Ping
Value received in the ping response.
Message representing a position in the source code.
Used in:
Line number.
Column number.
Filename the position refers to.
Used in:
List of schema type mappings.
Message representing a scope in KCL.
Used in:
Type of the scope.
Parent scope.
Owner of the scope.
Children of the scope.
Definitions in the scope.
Message representing a scope index.
Used in:
,Index identifier.
Global identifier.
Type of the scope.
Message representing a symbol in KCL.
Used in:
Type of the symbol.
Name of the symbol.
Owner of the symbol.
Definition of the symbol.
Attributes of the symbol.
Flag indicating if the symbol is global.
Message representing a symbol index.
Used in:
, ,Index identifier.
Global identifier.
Type of the symbol or scope.
Message representing information about a single test case.
Used in:
Name of the test case.
Error message if any.
Duration of the test case in microseconds.
Log message from the test case.
Message representing a variable.
Used in:
,Value of the variable.
Type name of the variable.
Operation symbol associated with the variable.
List items if the variable is a list.
Dictionary entries if the variable is a dictionary.
Message representing a list of variables.
Used in:
List of variables.