Skip to content

Use askQuestions tool in memory slash command when invoked from chat context#3897

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/update-clause-agent-invocation
Draft

Use askQuestions tool in memory slash command when invoked from chat context#3897
Copilot wants to merge 6 commits intomainfrom
copilot/update-clause-agent-invocation

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

The /memory slash command used QuickPick UI unconditionally. When invoked from a chat context, it should use the askQuestions tool instead for inline UX. The presence of toolInvocationToken distinguishes chat invocation from Command Palette invocation.

Changes

  • Thread toolInvocationToken through slash command layer: Added optional param to IClaudeSlashCommandHandler.handle() and IClaudeSlashCommandService.tryHandleCommand(), passed from request.toolInvocationToken at the call site in claudeChatSessionContentProvider.ts
  • MemorySlashCommand: branch on token presence: When toolInvocationToken is present, invoke CoreAskQuestions via IToolsService.invokeTool() with memory locations as question options. Falls back to existing QuickPick path when absent (Command Palette).
  • Single-location shortcut: When only one memory location exists (e.g., no workspace folders, only user memory), the file is opened directly without showing the askQuestions prompt.
async handle(
    _args: string,
    stream: vscode.ChatResponseStream | undefined,
    _token: CancellationToken,
    toolInvocationToken?: vscode.ChatParticipantToolToken
): Promise<vscode.ChatResult> {
    if (toolInvocationToken) {
        return this._handleWithAskQuestions(stream, toolInvocationToken);
    }
    // existing QuickPick path
}

Tests

New memoryCommand.spec.ts covering: tool invocation with token, correct options based on workspace state (user/project/local memory locations), skipped answers, empty responses, tool errors, and single-location direct-open shortcut.

Original prompt

In the memory slash command for the Claude agent integration, I want the slash command invocation to use the askQuestions tool instead of the quick picks.

I think you'll need to pass down the chatinvocationtoken and use the presence of that as a signal to use either the quick picks or the tool.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 20, 2026 17:12
…n is present

Thread toolInvocationToken through the slash command interface and service,
and modify MemorySlashCommand to use the askQuestions tool (instead of
QuickPick) when invoked from a chat context with a toolInvocationToken.

Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>
Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>
Copilot AI changed the title [WIP] Update memory slash command to use askQuestions tool Use askQuestions tool in memory slash command when invoked from chat context Feb 20, 2026
Copilot AI requested a review from TylerLeonhardt February 20, 2026 17:16
@TylerLeonhardt
Copy link
Member

@copilot lots of stuff has changed, why don't you give this another go

…command

Re-implemented all changes on top of current main to resolve conflicts.
Thread toolInvocationToken through the slash command interface and service,
and modify MemorySlashCommand to use askQuestions tool when invoked from
chat context. Opens file directly when only one memory location exists.

Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 26, 2026

@copilot lots of stuff has changed, why don't you give this another go

Re-implemented all changes on top of the latest main in f74be00. Also added a single-location shortcut that opens the file directly when only one memory location exists (e.g., no workspace folders = only user memory) instead of showing the askQuestions prompt with a single option.

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.

2 participants