Skip to content

Commit b81c2cd

Browse files
kubawookuba
andauthored
ui: Fix handling of MCP resource template parameters (ggml-org#23117)
* Fix handling of MCP resource template parameters * Fix formatting for uri-template.test.ts --------- Co-authored-by: kuba <kuba@laptop.local.net>
1 parent 1428004 commit b81c2cd

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

tools/ui/src/lib/utils/uri-template.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export function expandTemplate(template: string, values: Record<string, string>)
160160
(name: string, i: number) =>
161161
`${encodeURIComponent(name)}=${encodeURIComponent(expandedParts[i])}`
162162
)
163-
.join(URI_TEMPLATE_SEPARATORS.COMMA)
163+
.join(URI_TEMPLATE_SEPARATORS.QUERY_CONTINUATION)
164164
);
165165
case URI_TEMPLATE_OPERATORS.FORM_CONTINUATION:
166166
// Form-style query continuation

tools/ui/tests/unit/uri-template.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ describe('expandTemplate', () => {
107107
expect(result).toBe('http://example.com?q=search%20term');
108108
});
109109

110+
it('expands multiple query parameters', () => {
111+
const result = expandTemplate('http://example.com{?q,sort}', {
112+
q: 'search term',
113+
sort: 'descending'
114+
});
115+
expect(result).toBe('http://example.com?q=search%20term&sort=descending');
116+
});
117+
110118
it('keeps static parts unchanged', () => {
111119
const result = expandTemplate('http://example.com/static', {});
112120
expect(result).toBe('http://example.com/static');

0 commit comments

Comments
 (0)