Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/bin/chrome-devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ for (const [commandName, commandDef] of Object.entries(commands)) {
commandDef.description,
y => {
y.option('format', {
choices: ['text', 'json'],
default: 'text',
choices: ['md', 'json'],
default: 'md',
});
for (const [argName, opt] of Object.entries(args)) {
const type =
Expand Down Expand Up @@ -173,7 +173,7 @@ for (const [commandName, commandDef] of Object.entries(commands)) {
console.log(
handleResponse(
JSON.parse(response.result) as unknown as CallToolResult,
argv['format'] as 'json' | 'text',
argv['format'] as 'json' | 'md',
),
);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/daemon/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export async function stopDaemon() {

export function handleResponse(
response: CallToolResult,
format: 'json' | 'text',
format: 'json' | 'md',
): string {
if (response.isError) {
return JSON.stringify(response.content);
Expand All @@ -165,5 +165,5 @@ export function handleResponse(
throw new Error('Not supported response content type');
}
}
return format === 'text' ? chunks.join('') : JSON.stringify(chunks);
return format === 'md' ? chunks.join('') : JSON.stringify(chunks);
}
6 changes: 3 additions & 3 deletions tests/daemon/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('daemon client', () => {
describe('parsing', () => {
it('handles MCP response with text format', async () => {
const textResponse = {content: [{type: 'text' as const, text: 'test'}]};
assert.strictEqual(handleResponse(textResponse, 'text'), 'test');
assert.strictEqual(handleResponse(textResponse, 'md'), 'test');
});

it('handles JSON response', async () => {
Expand All @@ -78,7 +78,7 @@ describe('daemon client', () => {
content: [{type: 'text' as const, text: 'Something went wrong'}],
};
assert.strictEqual(
handleResponse(errorResponse, 'text'),
handleResponse(errorResponse, 'md'),
JSON.stringify(errorResponse.content),
);
});
Expand Down Expand Up @@ -108,7 +108,7 @@ describe('daemon client', () => {
structuredContent: {},
};
assert.throws(
() => handleResponse(unsupportedContentResponse, 'text'),
() => handleResponse(unsupportedContentResponse, 'md'),
new Error('Not supported response content type'),
);
});
Expand Down
Loading