@adhisang/minecraft-modding-mcp 4.2.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +5 -4
- package/dist/access-transformer-parser.d.ts +2 -1
- package/dist/access-transformer-parser.js +10 -1
- package/dist/build-suggested-call.js +31 -10
- package/dist/cache-registry.d.ts +8 -0
- package/dist/cache-registry.js +15 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +4 -0
- package/dist/entry-tools/analyze-mod-service.d.ts +24 -24
- package/dist/entry-tools/analyze-symbol-service.d.ts +57 -22
- package/dist/entry-tools/analyze-symbol-service.js +124 -28
- package/dist/entry-tools/batch-class-members-service.d.ts +3 -1
- package/dist/entry-tools/batch-class-members-service.js +6 -6
- package/dist/entry-tools/batch-class-source-service.d.ts +3 -1
- package/dist/entry-tools/batch-class-source-service.js +5 -6
- package/dist/entry-tools/batch-mappings-service.d.ts +3 -1
- package/dist/entry-tools/batch-mappings-service.js +4 -5
- package/dist/entry-tools/batch-symbol-exists-service.d.ts +3 -1
- package/dist/entry-tools/batch-symbol-exists-service.js +4 -5
- package/dist/entry-tools/compare-minecraft-service.d.ts +10 -10
- package/dist/entry-tools/entry-tool-schema.d.ts +1 -1
- package/dist/entry-tools/inspect-minecraft/handlers/artifact.js +1 -3
- package/dist/entry-tools/inspect-minecraft/handlers/class-members.js +2 -2
- package/dist/entry-tools/inspect-minecraft/handlers/class-overview.js +0 -5
- package/dist/entry-tools/inspect-minecraft/handlers/class-source.js +0 -1
- package/dist/entry-tools/inspect-minecraft/handlers/file.js +0 -1
- package/dist/entry-tools/inspect-minecraft/handlers/list-files.js +0 -1
- package/dist/entry-tools/inspect-minecraft/handlers/search.d.ts +8 -0
- package/dist/entry-tools/inspect-minecraft/handlers/search.js +13 -2
- package/dist/entry-tools/inspect-minecraft/handlers/versions.d.ts +1 -1
- package/dist/entry-tools/inspect-minecraft/handlers/versions.js +1 -1
- package/dist/entry-tools/inspect-minecraft/internal.d.ts +90 -89
- package/dist/entry-tools/inspect-minecraft/internal.js +30 -14
- package/dist/entry-tools/inspect-minecraft-service.d.ts +218 -218
- package/dist/entry-tools/inspect-minecraft-service.js +1 -1
- package/dist/entry-tools/manage-cache-service.d.ts +4 -4
- package/dist/entry-tools/response-contract.d.ts +1 -1
- package/dist/entry-tools/response-contract.js +1 -0
- package/dist/entry-tools/validate-project/cases/mixin.js +2 -1
- package/dist/entry-tools/validate-project/cases/project-summary.js +5 -3
- package/dist/entry-tools/validate-project-service.d.ts +42 -36
- package/dist/entry-tools/validate-project-service.js +3 -1
- package/dist/entry-tools/verify-mixin-target-service.d.ts +30 -0
- package/dist/entry-tools/verify-mixin-target-service.js +113 -22
- package/dist/error-mapping.d.ts +51 -0
- package/dist/error-mapping.js +157 -2
- package/dist/index.js +138 -71
- package/dist/mapping/internal-types.d.ts +7 -0
- package/dist/mapping/lookup.d.ts +1 -1
- package/dist/mapping/lookup.js +7 -1
- package/dist/mapping/types.d.ts +6 -0
- package/dist/mapping-service.d.ts +26 -2
- package/dist/mapping-service.js +178 -36
- package/dist/mcp-helpers.d.ts +1 -0
- package/dist/mcp-helpers.js +25 -3
- package/dist/minecraft-explorer-service.js +24 -11
- package/dist/mixin/access-validators.js +33 -1
- package/dist/mixin/annotation-validators.js +53 -7
- package/dist/mixin/parsed-validator.js +2 -2
- package/dist/mixin-parser.js +48 -4
- package/dist/mod-decompile-service.js +2 -1
- package/dist/mod-remap-service.d.ts +20 -1
- package/dist/mod-remap-service.js +95 -40
- package/dist/nbt/java-nbt-codec.js +6 -0
- package/dist/observability.d.ts +6 -0
- package/dist/observability.js +10 -0
- package/dist/page-cursor.d.ts +17 -0
- package/dist/page-cursor.js +0 -0
- package/dist/registry-service.js +25 -1
- package/dist/resources.js +45 -9
- package/dist/response-utils.d.ts +29 -4
- package/dist/response-utils.js +95 -5
- package/dist/source/access-validate.js +12 -2
- package/dist/source/artifact-resolver.js +1 -1
- package/dist/source/class-source/members-builder.d.ts +44 -1
- package/dist/source/class-source/members-builder.js +51 -4
- package/dist/source/class-source/snippet-builder.d.ts +13 -0
- package/dist/source/class-source/snippet-builder.js +48 -4
- package/dist/source/class-source-helpers.js +67 -11
- package/dist/source/class-source.js +97 -20
- package/dist/source/indexer.js +5 -2
- package/dist/source/search.d.ts +1 -1
- package/dist/source/search.js +94 -22
- package/dist/source/validate-mixin.d.ts +2 -1
- package/dist/source/validate-mixin.js +45 -4
- package/dist/source/workspace-target.js +15 -9
- package/dist/source-jar-reader.d.ts +54 -1
- package/dist/source-jar-reader.js +121 -10
- package/dist/source-service.d.ts +28 -7
- package/dist/storage/files-repo.d.ts +12 -0
- package/dist/storage/files-repo.js +24 -0
- package/dist/storage/symbols-repo.d.ts +6 -0
- package/dist/storage/symbols-repo.js +6 -0
- package/dist/symbols/symbol-extractor.js +35 -6
- package/dist/text-truncate.d.ts +7 -0
- package/dist/text-truncate.js +21 -0
- package/dist/tiny-remapper-resolver.js +10 -0
- package/dist/tool-contract-manifest.js +2 -2
- package/dist/tool-execution-gate.js +12 -1
- package/dist/tool-guidance.d.ts +4 -1
- package/dist/tool-guidance.js +37 -12
- package/dist/tool-schemas.d.ts +559 -494
- package/dist/tool-schemas.js +99 -63
- package/dist/types.d.ts +1 -0
- package/dist/version-diff-service.js +5 -0
- package/dist/version-service.d.ts +3 -0
- package/dist/version-service.js +18 -2
- package/dist/warning-details.d.ts +18 -0
- package/dist/warning-details.js +63 -0
- package/docs/README-ja.md +2 -2
- package/docs/examples.md +26 -2
- package/docs/tool-reference.md +22 -17
- package/package.json +1 -1
package/dist/tool-guidance.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ZodError } from "zod";
|
|
2
2
|
import { buildSuggestedCall } from "./build-suggested-call.js";
|
|
3
3
|
import { ERROR_CODES, isAppError } from "./errors.js";
|
|
4
|
-
import { statusForErrorCode } from "./error-mapping.js";
|
|
4
|
+
import { extractAllowlistedContext, issueOriginForErrorCode, retryClassForErrorCode, statusForErrorCode } from "./error-mapping.js";
|
|
5
5
|
export const SUGGESTED_CALL_DEFAULTS = {
|
|
6
6
|
allowDecompile: true,
|
|
7
7
|
preferProjectVersion: false,
|
|
@@ -14,7 +14,7 @@ export const SUGGESTED_CALL_DEFAULTS = {
|
|
|
14
14
|
explain: false,
|
|
15
15
|
preferProjectMapping: false,
|
|
16
16
|
minSeverity: "all",
|
|
17
|
-
reportMode: "
|
|
17
|
+
reportMode: "summary-first",
|
|
18
18
|
treatInfoAsWarning: true,
|
|
19
19
|
includeIssues: true
|
|
20
20
|
};
|
|
@@ -98,14 +98,19 @@ export function extractValidatedSuggestionAndExamples(details) {
|
|
|
98
98
|
typeof ex.reason !== "string") {
|
|
99
99
|
continue;
|
|
100
100
|
}
|
|
101
|
+
// Re-validate through the example path, not the primary path: example
|
|
102
|
+
// calls are templates and MAY carry placeholder sentinels (e.g.
|
|
103
|
+
// "<version>"), which the primary gate intentionally rejects.
|
|
101
104
|
const result = buildSuggestedCall({
|
|
102
105
|
tool: ex.tool,
|
|
103
|
-
params:
|
|
106
|
+
params: undefined,
|
|
107
|
+
examples: [{ params: ex.params, reason: ex.reason }]
|
|
104
108
|
});
|
|
105
|
-
|
|
109
|
+
const validatedExample = result.exampleCalls?.[0];
|
|
110
|
+
if (validatedExample) {
|
|
106
111
|
validated.push({
|
|
107
112
|
tool: ex.tool,
|
|
108
|
-
params:
|
|
113
|
+
params: validatedExample.params,
|
|
109
114
|
reason: ex.reason
|
|
110
115
|
});
|
|
111
116
|
}
|
|
@@ -414,12 +419,10 @@ export function buildSourceLookupSuggestedParams(tool, normalizedInput) {
|
|
|
414
419
|
const targetValue = asNonEmptyString(record?.target);
|
|
415
420
|
result.target = targetValue
|
|
416
421
|
? {
|
|
417
|
-
type: "resolve",
|
|
418
422
|
kind: inferTargetKindFromString(targetValue),
|
|
419
423
|
value: targetValue
|
|
420
424
|
}
|
|
421
425
|
: {
|
|
422
|
-
type: "resolve",
|
|
423
426
|
kind: "version",
|
|
424
427
|
value: "<minecraft-version>"
|
|
425
428
|
};
|
|
@@ -607,7 +610,21 @@ export function buildValidateProjectSuggestedParams(normalizedInput) {
|
|
|
607
610
|
return result;
|
|
608
611
|
}
|
|
609
612
|
function gatedGuidance(tool, hints, params) {
|
|
610
|
-
|
|
613
|
+
// Pass the reconstructed params as both the primary and a fallback example.
|
|
614
|
+
// When they are fully executable they become `suggestedCall`; when they still
|
|
615
|
+
// carry `<…>` placeholders (e.g. a missing version) the gate drops the
|
|
616
|
+
// primary and surfaces the same shape as an `exampleCalls` template instead
|
|
617
|
+
// of emitting a non-callable suggestedCall.
|
|
618
|
+
const validated = buildSuggestedCall({
|
|
619
|
+
tool,
|
|
620
|
+
params,
|
|
621
|
+
examples: [
|
|
622
|
+
{
|
|
623
|
+
params,
|
|
624
|
+
reason: `Example ${tool} call shape — replace any <…> placeholder values before sending.`
|
|
625
|
+
}
|
|
626
|
+
]
|
|
627
|
+
});
|
|
611
628
|
return {
|
|
612
629
|
hints,
|
|
613
630
|
...validated,
|
|
@@ -630,8 +647,8 @@ export function buildInvalidInputGuidance(tool, normalizedInput) {
|
|
|
630
647
|
}
|
|
631
648
|
if (tool === "get-class-source" || tool === "get-class-members") {
|
|
632
649
|
return gatedGuidance(tool, [
|
|
633
|
-
`${tool}.target must be an object: {"
|
|
634
|
-
"Bare string targets are not accepted; wrap the value under target.
|
|
650
|
+
`${tool}.target must be an object: {"kind":"version|jar|coordinate","value":"..."} or {"kind":"artifact","artifactId":"..."} (same shape as resolve-artifact).`,
|
|
651
|
+
"Bare string targets are not accepted; wrap the value under target.kind/target.value."
|
|
635
652
|
], buildSourceLookupSuggestedParams(tool, normalizedInput));
|
|
636
653
|
}
|
|
637
654
|
if (tool === "validate-project") {
|
|
@@ -666,6 +683,8 @@ export function mapErrorToProblem(caughtError, requestId, context) {
|
|
|
666
683
|
status: 400,
|
|
667
684
|
code: ERROR_CODES.INVALID_INPUT,
|
|
668
685
|
instance: requestId,
|
|
686
|
+
retryClass: retryClassForErrorCode(ERROR_CODES.INVALID_INPUT),
|
|
687
|
+
issueOrigin: issueOriginForErrorCode(ERROR_CODES.INVALID_INPUT),
|
|
669
688
|
fieldErrors: toFieldErrorsFromZod(caughtError),
|
|
670
689
|
hints: hintsWithFallback,
|
|
671
690
|
...(guidance?.suggestedCall ? { suggestedCall: guidance.suggestedCall } : {}),
|
|
@@ -675,6 +694,7 @@ export function mapErrorToProblem(caughtError, requestId, context) {
|
|
|
675
694
|
}
|
|
676
695
|
if (isAppError(caughtError)) {
|
|
677
696
|
const { suggestedCall, exampleCalls, primaryDropped } = extractValidatedSuggestionAndExamples(caughtError.details);
|
|
697
|
+
const sanitizedContext = extractAllowlistedContext(caughtError.details);
|
|
678
698
|
let failedStage = extractFailedStageFromDetails(caughtError.details);
|
|
679
699
|
if (!failedStage
|
|
680
700
|
&& context?.tool === "validate-mixin"
|
|
@@ -692,11 +712,14 @@ export function mapErrorToProblem(caughtError, requestId, context) {
|
|
|
692
712
|
status: statusForErrorCode(caughtError.code),
|
|
693
713
|
code: caughtError.code,
|
|
694
714
|
instance: requestId,
|
|
715
|
+
retryClass: retryClassForErrorCode(caughtError.code),
|
|
716
|
+
issueOrigin: issueOriginForErrorCode(caughtError.code),
|
|
695
717
|
fieldErrors: extractFieldErrorsFromDetails(caughtError.details),
|
|
696
718
|
hints: hintsWithFallback,
|
|
697
719
|
...(suggestedCall ? { suggestedCall } : {}),
|
|
698
720
|
...(exampleCalls ? { exampleCalls } : {}),
|
|
699
|
-
...(failedStage ? { failedStage } : {})
|
|
721
|
+
...(failedStage ? { failedStage } : {}),
|
|
722
|
+
...(sanitizedContext ? { context: sanitizedContext } : {})
|
|
700
723
|
};
|
|
701
724
|
}
|
|
702
725
|
return {
|
|
@@ -705,7 +728,9 @@ export function mapErrorToProblem(caughtError, requestId, context) {
|
|
|
705
728
|
detail: "Unexpected server error.",
|
|
706
729
|
status: 500,
|
|
707
730
|
code: ERROR_CODES.INTERNAL,
|
|
708
|
-
instance: requestId
|
|
731
|
+
instance: requestId,
|
|
732
|
+
retryClass: retryClassForErrorCode(ERROR_CODES.INTERNAL),
|
|
733
|
+
issueOrigin: issueOriginForErrorCode(ERROR_CODES.INTERNAL)
|
|
709
734
|
};
|
|
710
735
|
}
|
|
711
736
|
/**
|