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
3 changes: 2 additions & 1 deletion src/developer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ function fmtDeveloper(
const kind = r.id?.split(':', 1)[0];
const kindLabel = kind ? ` (${kind})` : '';
const lines = [`## [${id}]${kindLabel} ${r.title ?? '(untitled)'}`];
if (r.url) lines.push(r.url);
if (r.url && !id.endsWith(`:${r.url}`) && id !== r.url) lines.push(r.url);
const body = (r.passages ?? [])
.map((p) => p.text ?? '')
.filter((passage) => passage.trim().length > 0)
.join('\n---\n')
.trim();
// Passages are server-shaped (search-side budget is always on); no
Expand Down
29 changes: 29 additions & 0 deletions tests/mcp-smoke.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,23 @@ async function startFakeDeveloperApi() {
title: 'Developer fixture',
url: 'https://example.com/developer',
},
{
id: 'web:https://example.com/answer',
passages: [
{ text: '' },
{ text: ' ' },
{ text: 'The answer.' },
{},
],
title: 'Developer answer',
url: 'https://example.com/answer',
},
{
id: 'web:https://example.com/base/child',
passages: [{ text: 'The base answer.' }],
title: 'Developer base answer',
url: 'https://example.com/base',
},
],
success: true,
})
Expand Down Expand Up @@ -932,6 +949,18 @@ test('developer search serves server-shaped passages uncapped', async (t) => {
});
assert.notEqual(serverBudgeted.isError, true);
assert.ok(serverBudgeted.content[0].text.includes(fakeApi.passage));
assert.equal(
serverBudgeted.content[0].text.match(/https:\/\/example\.com\/answer/g)
?.length,
1
);
assert.ok(serverBudgeted.content[0].text.includes('\nThe answer.'));
assert.equal(serverBudgeted.content[0].text.includes('\n---\n'), false);
assert.ok(
serverBudgeted.content[0].text.includes(
'## [web:https://example.com/base/child] (web) Developer base answer\nhttps://example.com/base\n'
)
);

// No client-side cap in any case: even a response without
// passage_budget_applied (older server) serves the passage whole.
Expand Down
Loading