Skip to content

feat: register #bedrockContext LM tool for Copilot Chat project context#541

Merged
DaanV2 merged 7 commits into
mainfrom
copilot/register-bedrockcontext-chat-variable-again
May 24, 2026
Merged

feat: register #bedrockContext LM tool for Copilot Chat project context#541
DaanV2 merged 7 commits into
mainfrom
copilot/register-bedrockcontext-chat-variable-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 23, 2026

  • Add RequestTypes.WorkspaceContext and WorkspaceContextSummary / WorkspacePackSummary types to ide/shared/src/constants.ts
  • Extend WorkspaceProjectDataCollections with packs arrays and add getWorkspaceContextSummary + handler in ide/base/server/src/lsp/language-model-tools/service.ts
  • Register blockception.minecraft.bedrockContext LM tool in ide/base/client/src/commands/language-model-tools.ts
  • Contribute the new tool in ide/vscode/package.json with canBeReferencedInPrompt: true
  • Add/update tests in service.test.ts (5 new tests, all passing)
  • Fix CI TypeScript build failure (round 1): CollectionKeys<T> helper type
  • Fix CI TypeScript build failure (round 2): Add packs: [] to mock objects in dataset/service.test.ts
  • Merge conflicts resolved
  • Fix test failure: add onLanguageModelTool:blockception.minecraft.bedrockContext to activationEvents in ide/vscode/package.json (required by language-model-tools-manifest.test.ts)

Copilot AI linked an issue May 23, 2026 that may be closed by this pull request
@DaanV2 DaanV2 added enhancement New feature or request feature labels May 23, 2026
Copilot AI and others added 2 commits May 23, 2026 18:43
- Add RequestTypes.WorkspaceContext LSP request + WorkspaceContextSummary / WorkspacePackSummary types to ide/shared/src/constants.ts
- Extend WorkspaceProjectDataCollections with packs arrays and add getWorkspaceContextSummary + handler in service.ts
- Register blockception.minecraft.bedrockContext LM tool in language-model-tools.ts
- Contribute new tool in ide/vscode/package.json with canBeReferencedInPrompt: true
- Add 5 new tests for getWorkspaceContextSummary in service.test.ts

Agent-Logs-Url: https://github.com/Blockception/minecraft-bedrock-language-server/sessions/7ef8dcb3-c496-4273-a567-dff0c4f2bfc8

Co-authored-by: DaanV2 <2393905+DaanV2@users.noreply.github.com>
Copilot AI changed the title [WIP] Add #bedrockContext chat variable for project-specific information feat: register #bedrockContext LM tool for Copilot Chat project context May 23, 2026
Copilot finished work on behalf of DaanV2 May 23, 2026 19:01
Copilot AI requested a review from DaanV2 May 23, 2026 19:01
@DaanV2 DaanV2 marked this pull request as ready for review May 23, 2026 19:45
@github-actions github-actions Bot added dependencies Pull requests that update a dependency file vscode ide labels May 23, 2026
@DaanV2
Copy link
Copy Markdown
Contributor

DaanV2 commented May 23, 2026

@copilot there are pipelines errors during building

…collection types

Add CollectionKeys<T> helper type that filters to only keys whose values extend
CollectionWithIds, preventing the packs: ReadonlyArray<PackEntry> field from
being included in the key union. This fixes the 5 TypeScript errors the CI
Windows build reported.

Agent-Logs-Url: https://github.com/Blockception/minecraft-bedrock-language-server/sessions/33615915-486f-4c8f-81ce-03eae0f47ded

Co-authored-by: DaanV2 <2393905+DaanV2@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 23, 2026

@copilot there are pipelines errors during building

Fixed in 7497cd9. The CI failure was 5 TypeScript TS2322 errors: adding packs: ReadonlyArray<PackEntry> to WorkspaceProjectDataCollections caused the generic key parameters in the collection selector helpers to include packs in their union, making the inferred type CollectionWithIds | readonly PackEntry[] instead of just CollectionWithIds.

Added a CollectionKeys<T> mapped helper type that filters to only the keys whose values extend CollectionWithIds, and used as CollectionWithIds casts at the access sites. Server now compiles clean (tsc -b exits 0) and all 8 tests pass.

Copilot finished work on behalf of DaanV2 May 23, 2026 20:38
Copilot AI requested a review from DaanV2 May 23, 2026 20:38
@DaanV2
Copy link
Copy Markdown
Contributor

DaanV2 commented May 23, 2026

@copilot Following errors on windows pipeline:

src/lsp/dataset/service.test.ts:13:5 - error TS2741: Property 'packs' is missing in type '{ entities: { forEach(callbackfn: (item: { id?: string; }) => void): void; }; items: { forEach(callbackfn: (item: { id?: string; }) => void): void; }; blocks: { forEach(callbackfn: (item: { id?: string; }) => void): void; }; ... 11 more ...; itemGroups: { forEach(callbackfn: (item: { id?: string; }) => void): void; ...' but required in type '{ packs: readonly PackEntry[]; entities: CollectionWithIds; items: CollectionWithIds; blocks: CollectionWithIds; biomes: CollectionWithIds; ... 10 more ...; itemGroups: CollectionWithIds; }'.

13     behaviorPacks: {
       ~~~~~~~~~~~~~

  src/lsp/language-model-tools/service.ts:24:5
    24     packs: ReadonlyArray<PackEntry>;
           ~~~~~
    'packs' is declared here.
  src/lsp/language-model-tools/service.ts:23:3
    23   behaviorPacks: {
         ~~~~~~~~~~~~~
    The expected type comes from property 'behaviorPacks' which is declared here on type 'WorkspaceProjectDataCollections'

src/lsp/dataset/service.test.ts:30:5 - error TS2741: Property 'packs' is missing in type '{ entities: { forEach(callbackfn: (item: { id?: string; }) => void): void; }; animations: { forEach(callbackfn: (item: { id?: string; }) => void): void; }; animationControllers: { forEach(callbackfn: (item: { id?: string; }) => void): void; }; ... 11 more ...; uiElements: { forEach(callbackfn: (item: { id?: string; ...' but required in type '{ packs: readonly PackEntry[]; entities: CollectionWithIds; animations: CollectionWithIds; animationControllers: CollectionWithIds; ... 11 more ...; uiElements: CollectionWithIds; }'.

30     resourcePacks: {
       ~~~~~~~~~~~~~

  src/lsp/language-model-tools/service.ts:42:5
    42     packs: ReadonlyArray<PackEntry>;
           ~~~~~
    'packs' is declared here.
  src/lsp/language-model-tools/service.ts:41:3
    41   resourcePacks: {
         ~~~~~~~~~~~~~
    The expected type comes from property 'resourcePacks' which is declared here on type 'WorkspaceProjectDataCollections'

The dataset service test file on main imports WorkspaceProjectDataCollections
from the language-model-tools service; adding packs as a required field there
caused TS2741 errors in this test file too. Add packs: [] to both behaviorPacks
and resourcePacks mock objects.

Agent-Logs-Url: https://github.com/Blockception/minecraft-bedrock-language-server/sessions/c47c26ec-15a6-4a5d-95f1-39776d351bd3

Co-authored-by: DaanV2 <2393905+DaanV2@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 23, 2026

@copilot Following errors on windows pipeline:

...

Fixed in 1a43926. The dataset/service.test.ts file (from the main branch) imports WorkspaceProjectDataCollections from the language-model-tools service and constructs mock objects without the packs field I added as required. Added packs: [] to both behaviorPacks and resourcePacks mock objects in that file to satisfy the type.

Copilot finished work on behalf of DaanV2 May 23, 2026 20:50
@DaanV2
Copy link
Copy Markdown
Contributor

DaanV2 commented May 24, 2026

@copilot resolve the merge conflicts in this pull request

…aset/service.test.ts

Co-authored-by: DaanV2 <2393905+DaanV2@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 24, 2026

@copilot resolve the merge conflicts in this pull request

Done in 0de3da1. There was one add/add conflict in ide/base/server/src/lsp/dataset/service.test.ts — both branches added the file, with main lacking the packs: [] entries that our branch requires. Resolved by keeping packs: [] in both behaviorPacks and resourcePacks mock objects. All other files merged cleanly.

Copilot finished work on behalf of DaanV2 May 24, 2026 08:42
Copilot AI requested a review from DaanV2 May 24, 2026 08:42
@DaanV2
Copy link
Copy Markdown
Contributor

DaanV2 commented May 24, 2026

@copilot now there are test issues

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 24, 2026

@copilot now there are test issues

Fixed in 6478518. The language-model-tools-manifest.test.ts test (added by main) iterates all contributed languageModelTools and asserts each has a matching onLanguageModelTool:... activation event. The bedrockContext tool was contributed but its activation event was missing — added "onLanguageModelTool:blockception.minecraft.bedrockContext" to activationEvents in ide/vscode/package.json.

Copilot finished work on behalf of DaanV2 May 24, 2026 09:07
@DaanV2 DaanV2 merged commit dec2d38 into main May 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement New feature or request feature ide vscode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Register #bedrockContext Chat Variable for Copilot Chat

2 participants