Skip to content

Commit d841ac8

Browse files
committed
fix: preserve session mcp request options
1 parent 6a1d335 commit d841ac8

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

src/__tests__/client.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,25 @@ test('structured command input accepts target as deviceTarget alias when no UI t
148148
assert.equal(setup.calls[0]?.flags?.target, 'tv');
149149
});
150150

151+
test('structured session command forwards common request options', async () => {
152+
const setup = createTransport(async (req) => {
153+
if (req.command === 'session_list') {
154+
return { ok: true, data: { sessions: [] } };
155+
}
156+
throw new Error(`Unexpected command: ${req.command}`);
157+
});
158+
const client = createAgentDeviceClient({}, { transport: setup.transport });
159+
160+
await runCommand(client, 'session', {
161+
action: 'list',
162+
daemonBaseUrl: 'http://remote.example.test',
163+
});
164+
165+
assert.equal(setup.calls.length, 1);
166+
assert.equal(setup.calls[0]?.command, 'session_list');
167+
assert.equal(setup.calls[0]?.flags?.daemonBaseUrl, 'http://remote.example.test');
168+
});
169+
151170
test('structured interaction input keeps UI target separate from deviceTarget', async () => {
152171
const setup = createTransport(async (req) => {
153172
if (req.command === 'get' || req.command === 'longpress') {

src/commands/client-command-contracts.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ export const clientCommandDefinitions = [
6868
'session',
6969
'List active sessions.',
7070
{ action: enumField(['list']) },
71-
async (client) => ({ sessions: await client.sessions.list() }),
71+
async (client, { action: _action, ...input }) => ({
72+
sessions: await client.sessions.list(input),
73+
}),
7274
),
7375
defineFieldCommand(
7476
'open',

0 commit comments

Comments
 (0)