Skip to content

Commit bc527fc

Browse files
chore: clarify filter semantics and add list_macro_categories tool
1 parent 1d8248b commit bc527fc

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎mcp/src/index.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export class YourselfToScienceMCP extends McpAgent {
201201
inputSchema: {
202202
query: z.string().optional().describe("Free-text search across title, description, org, country, data type"),
203203
dataType: z.string().optional().describe('e.g. "Genome", "Wearable data", "Tissue"'),
204-
country: z.string().optional().describe('e.g. "Italy", "United States", "Worldwide"'),
204+
country: z.string().optional().describe('Filter by country where user participation is available (e.g. "Italy", "Worldwide"). Returns both exact matches and Worldwide projects.'),
205205
compensationType: z.string().optional().describe('"donation" | "payment" | "mixed"'),
206206
category: z.string().optional().describe('Organization type, e.g. "Government", "Non-Profit", "Commercial", "Academic"'),
207207
macroCategory: z.string().optional().describe('Top-level grouping, e.g. "Health & Digital Data", "Biological Samples", "Clinical Trials", "Organ, Body & Tissue Donation"'),
@@ -271,6 +271,17 @@ export class YourselfToScienceMCP extends McpAgent {
271271
}
272272
);
273273

274+
this.server.registerTool(
275+
"list_macro_categories",
276+
{ title: "List macro categories", description: "All distinct macro categories (e.g. Clinical Trials, Biological Samples) with counts.", inputSchema: {}, annotations: RO },
277+
async () => {
278+
const all = await loadResources();
279+
const counts: Record<string, number> = {};
280+
for (const r of all) for (const m of r.macroCategories ?? []) counts[m] = (counts[m] ?? 0) + 1;
281+
return text({ results: Object.entries(counts).sort((a, b) => b[1] - a[1]).map(([name, count]) => ({ name, count })) });
282+
}
283+
);
284+
274285
this.server.registerTool(
275286
"list_compensation_types",
276287
{ title: "List compensation types", description: "All distinct compensation types (donation, payment, mixed) with counts.", inputSchema: {}, annotations: RO },

0 commit comments

Comments
 (0)