[
https://issues.apache.org/jira/browse/GROOVY-12487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18131317#comment-18131317
]
ASF GitHub Bot commented on GROOVY-12487:
-----------------------------------------
codecov-commenter commented on PR #3021:
URL: https://github.com/apache/groovy/pull/3021#issuecomment-6380945952
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3021?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
Report
:x: Patch coverage is `98.65659%` with `16 lines` in your changes missing
coverage. Please review.
:white_check_mark: Project coverage is 72.7267%. Comparing base
([`98c2f9f`](https://app.codecov.io/gh/apache/groovy/commit/98c2f9f106d2ee368278ca33d105e540bf23baf0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`0723ceb`](https://app.codecov.io/gh/apache/groovy/commit/0723ceb5c57c9b0f7248566ba5d241d4083ef16e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3021?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Patch % | Lines |
|---|---|---|
|
[...in/java/org/apache/groovy/mcp/GroovyMcpServer.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2FGroovyMcpServer.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9Hcm9vdnlNY3BTZXJ2ZXIuamF2YQ==)
| 98.5240% | [0 Missing and 4 partials :warning:
](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
|
[...a/org/apache/groovy/mcp/internal/EngineBridge.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2Finternal%2FEngineBridge.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9pbnRlcm5hbC9FbmdpbmVCcmlkZ2UuamF2YQ==)
| 98.5981% | [0 Missing and 3 partials :warning:
](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
|
[...che/groovy/lsp/internal/LanguageServerContext.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-lsp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Flsp%2Finternal%2FLanguageServerContext.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWxzcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L2xzcC9pbnRlcm5hbC9MYW5ndWFnZVNlcnZlckNvbnRleHQuamF2YQ==)
| 88.2353% | [0 Missing and 2 partials :warning:
](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
|
[.../java/org/apache/groovy/mcp/GroovyMcpLauncher.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2FGroovyMcpLauncher.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9Hcm9vdnlNY3BMYXVuY2hlci5qYXZh)
| 98.1482% | [2 Missing :warning:
](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
|
[...ava/org/apache/groovy/mcp/internal/PathPolicy.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2Finternal%2FPathPolicy.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9pbnRlcm5hbC9QYXRoUG9saWN5LmphdmE=)
| 95.3488% | [2 Missing :warning:
](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
|
[...va/org/apache/groovy/mcp/internal/ToolCatalog.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2Finternal%2FToolCatalog.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9pbnRlcm5hbC9Ub29sQ2F0YWxvZy5qYXZh)
| 99.2278% | [0 Missing and 2 partials :warning:
](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
|
[...va/org/apache/groovy/mcp/internal/ArgumentMap.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2Finternal%2FArgumentMap.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9pbnRlcm5hbC9Bcmd1bWVudE1hcC5qYXZh)
| 97.8723% | [0 Missing and 1 partial :warning:
](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #3021 +/- ##
==================================================
+ Coverage 72.5157% 72.7267% +0.2110%
- Complexity 40761 41219 +458
==================================================
Files 1644 1658 +14
Lines 143027 144207 +1180
Branches 26899 27079 +180
==================================================
+ Hits 103717 104877 +1160
- Misses 29759 29769 +10
- Partials 9551 9561 +10
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3021?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[...oovy/lsp/internal/engine/GroovyLanguageEngine.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-lsp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Flsp%2Finternal%2Fengine%2FGroovyLanguageEngine.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWxzcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L2xzcC9pbnRlcm5hbC9lbmdpbmUvR3Jvb3Z5TGFuZ3VhZ2VFbmdpbmUuamF2YQ==)
| `87.3077% <100.0000%> (+1.0332%)` | :arrow_up: |
|
[...in/java/org/apache/groovy/mcp/McpServerConfig.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2FMcpServerConfig.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9NY3BTZXJ2ZXJDb25maWcuamF2YQ==)
| `100.0000% <100.0000%> (ø)` | |
|
[...java/org/apache/groovy/mcp/internal/JsonCodec.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2Finternal%2FJsonCodec.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9pbnRlcm5hbC9Kc29uQ29kZWMuamF2YQ==)
| `100.0000% <100.0000%> (ø)` | |
|
[...ava/org/apache/groovy/mcp/internal/JsonValues.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2Finternal%2FJsonValues.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9pbnRlcm5hbC9Kc29uVmFsdWVzLmphdmE=)
| `100.0000% <100.0000%> (ø)` | |
|
[.../org/apache/groovy/mcp/internal/PromptCatalog.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2Finternal%2FPromptCatalog.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9pbnRlcm5hbC9Qcm9tcHRDYXRhbG9nLmphdmE=)
| `100.0000% <100.0000%> (ø)` | |
|
[.../apache/groovy/mcp/internal/ProtocolException.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2Finternal%2FProtocolException.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9pbnRlcm5hbC9Qcm90b2NvbEV4Y2VwdGlvbi5qYXZh)
| `100.0000% <100.0000%> (ø)` | |
|
[...rg/apache/groovy/mcp/internal/ResourceCatalog.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2Finternal%2FResourceCatalog.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9pbnRlcm5hbC9SZXNvdXJjZUNhdGFsb2cuamF2YQ==)
| `100.0000% <100.0000%> (ø)` | |
|
[...va/org/apache/groovy/mcp/internal/StdioFrames.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2Finternal%2FStdioFrames.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9pbnRlcm5hbC9TdGRpb0ZyYW1lcy5qYXZh)
| `100.0000% <100.0000%> (ø)` | |
|
[...va/org/apache/groovy/mcp/internal/ToolFailure.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2Finternal%2FToolFailure.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9pbnRlcm5hbC9Ub29sRmFpbHVyZS5qYXZh)
| `100.0000% <100.0000%> (ø)` | |
|
[...va/org/apache/groovy/mcp/internal/ArgumentMap.java](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree&filepath=subprojects%2Fgroovy-mcp%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fmcp%2Finternal%2FArgumentMap.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LW1jcC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ3Jvb3Z5L21jcC9pbnRlcm5hbC9Bcmd1bWVudE1hcC5qYXZh)
| `97.8723% <97.8723%> (ø)` | |
| ... and [6
more](https://app.codecov.io/gh/apache/groovy/pull/3021?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| |
... and [12 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/3021/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests,
report on failures, and find test suite problems.
- :package: [JS Bundle
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save
yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
> Add an optional MCP server
> --------------------------
>
> Key: GROOVY-12487
> URL: https://issues.apache.org/jira/browse/GROOVY-12487
> Project: Groovy
> Issue Type: New Feature
> Reporter: Daniel Sun
> Priority: Major
>
> An agent needs to ask the Groovy compiler about source without running that
> source. {{groovy-mcp}} is an optional subproject that speaks the Model
> Context Protocol (MCP) over stdio. It calls the existing
> {{GroovyLanguageEngine}} in {{groovy-lsp}}. It is not a second compiler, and
> it is not part of {{groovy-all}}.
> h3. Launch
> {noformat}
> groovymcp [--stdio] [--root DIR] [--classpath PATH] [--version] [--help]
> {noformat}
> * {{--stdio}} is accepted and changes nothing. Stdio is the only transport.
> * {{--root}} confines every {{path}} argument to that directory. The
> directory is not scanned. Without it, {{path}} is rejected and in-memory
> {{text}} still works.
> * {{--classpath}} is the compile classpath. It is fixed at launch. A tool
> call cannot change it, and the server reports the entry count, not the paths.
> * {{--help}} wins over later arguments and exits 0. {{--version}} prints
> {{groovy-mcp}} and the implementation version.
> Stdout is the protocol stream. Server logs go to stderr. {{main}} redirects
> incidental standard output to stderr only while the process is serving, and
> restores it afterwards.
> h3. Protocol
> One JSON-RPC 2.0 message is one UTF-8 line. A JSON array (a batch) is
> rejected. CRLF is one line; the CR is not part of the payload and does not
> count toward the message cap.
> Supported protocol versions are {{2025-11-25}}, {{2025-06-18}},
> {{2025-03-26}}, and {{2024-11-05}}. A supported version is echoed. Any other
> non-empty version is answered as {{2025-11-25}}.
> A session must {{initialize}}, then send {{notifications/initialized}},
> before tools, resources, or prompts answer. {{ping}} is allowed earlier. A
> second {{initialize}} is an error. Requests before the session is ready
> return {{-32002}}.
> * A tool mistake, including an unknown tool, is a successful response with
> {{isError}} set. The unknown-tool text is the constant {{unknown tool}}. The
> name from the request is not repeated.
> * An unknown resource, an unknown prompt, or an argument value that is not an
> object returns {{-32602}}.
> * An unexpected failure is {{-32603}} with the message {{Internal error}}.
> The log records the exception class and a short message, not the source text.
> * {{notifications/cancelled}} is ignored. The session handles one request at
> a time, and a compile is not interrupted.
> Tool input and output schemas use JSON Schema 2020-12. Each tool has a title
> and an {{outputSchema}}. A successful {{structuredContent}} matches that
> schema. A failed call's {{structuredContent}} is an {{error}} string.
> h3. What the server exposes
> Thirteen read-only tools wrap the engine: diagnostics, describe, definition,
> implementations, references, symbols, complete, signatures, tokens, format,
> organize-imports, rename, and close. Format, organize-imports, and rename
> return edits. They do not write files. An empty rename means the compiler did
> not prove the binding.
> Positions are 0-based UTF-16 and are passed through unchanged.
> Source is passed in one of three ways:
> * {{text}} keeps the source in a {{groovy-buffer}} URI. The default is
> {{groovy-buffer:snippet}}. {{text}} may also carry a {{uri}} of that scheme.
> It is not attached to a file URI.
> * {{path}} reads one file under {{--root}}.
> * {{uri}} addresses a buffer that is already open. A file URI must stay
> inside the root, including the path after symbolic links are resolved.
> {{text}} together with {{path}} is rejected, and so is {{path}} together with
> {{uri}}.
> Three JSON resources list the lexer keywords, the default imports, and the
> server limits. The keyword list and the default imports come from the
> compiler. Two prompts, {{explain-groovy}} and {{review-groovy}}, tell the
> model to use those tools and not to run the source. The server does not treat
> the prompt text as instructions to itself.
> h3. Limits and safety
> Defaults are 2 MiB for one message, 512 Ki characters of source, and 512 Ki
> characters of result JSON. Oversized tool JSON is replaced with an error
> result. Client strings that must be quoted are shortened, and control
> characters are replaced.
> There is no evaluate tool. Grab and ASTTest stay disabled. The process does
> not walk a workspace, invoke Gradle or Maven, or download dependencies.
> Sampling, elicitation, tasks, and HTTP transports are not implemented. The
> module does not depend on an MCP library or an LLM client library. JSON is
> parsed and written with {{groovy.json}}.
> h3. Build
> The module is optional. Binary-compatibility checks are off until a release
> has published a baseline jar, as with {{groovy-lsp}}. The jar's main class is
> {{org.apache.groovy.mcp.GroovyMcpLauncher}}. The binary distribution ships
> the jar, {{groovymcp}}, and {{groovymcp.bat}}. Both scripts are force-added
> because {{bin/}} is ignored, the same way {{groovylsp}} is tracked. The user
> guide is included from the binary documentation.
> The public types are {{GroovyMcpServer}}, {{GroovyMcpLauncher}}, and
> {{McpServerConfig}}. Types under {{org.apache.groovy.mcp.internal}} are not a
> supported API.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)