@cyanheads/who-gho-mcp-server 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CLAUDE.md +391 -0
  2. package/Dockerfile +98 -0
  3. package/LICENSE +201 -0
  4. package/README.md +294 -0
  5. package/changelog/0.1.x/0.1.0.md +20 -0
  6. package/changelog/0.1.x/0.1.1.md +23 -0
  7. package/changelog/template.md +119 -0
  8. package/dist/config/server-config.d.ts +9 -0
  9. package/dist/config/server-config.d.ts.map +1 -0
  10. package/dist/config/server-config.js +28 -0
  11. package/dist/config/server-config.js.map +1 -0
  12. package/dist/index.d.ts +7 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +36 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/mcp-server/resources/definitions/who-dimension-values.resource.d.ts +18 -0
  17. package/dist/mcp-server/resources/definitions/who-dimension-values.resource.d.ts.map +1 -0
  18. package/dist/mcp-server/resources/definitions/who-dimension-values.resource.js +41 -0
  19. package/dist/mcp-server/resources/definitions/who-dimension-values.resource.js.map +1 -0
  20. package/dist/mcp-server/resources/definitions/who-indicator-metadata.resource.d.ts +16 -0
  21. package/dist/mcp-server/resources/definitions/who-indicator-metadata.resource.d.ts.map +1 -0
  22. package/dist/mcp-server/resources/definitions/who-indicator-metadata.resource.js +44 -0
  23. package/dist/mcp-server/resources/definitions/who-indicator-metadata.resource.js.map +1 -0
  24. package/dist/mcp-server/tools/definitions/who-get-indicator-metadata.tool.d.ts +25 -0
  25. package/dist/mcp-server/tools/definitions/who-get-indicator-metadata.tool.d.ts.map +1 -0
  26. package/dist/mcp-server/tools/definitions/who-get-indicator-metadata.tool.js +112 -0
  27. package/dist/mcp-server/tools/definitions/who-get-indicator-metadata.tool.js.map +1 -0
  28. package/dist/mcp-server/tools/definitions/who-list-dimension-values.tool.d.ts +24 -0
  29. package/dist/mcp-server/tools/definitions/who-list-dimension-values.tool.d.ts.map +1 -0
  30. package/dist/mcp-server/tools/definitions/who-list-dimension-values.tool.js +76 -0
  31. package/dist/mcp-server/tools/definitions/who-list-dimension-values.tool.js.map +1 -0
  32. package/dist/mcp-server/tools/definitions/who-list-dimensions.tool.d.ts +12 -0
  33. package/dist/mcp-server/tools/definitions/who-list-dimensions.tool.d.ts.map +1 -0
  34. package/dist/mcp-server/tools/definitions/who-list-dimensions.tool.js +38 -0
  35. package/dist/mcp-server/tools/definitions/who-list-dimensions.tool.js.map +1 -0
  36. package/dist/mcp-server/tools/definitions/who-list-indicators.tool.d.ts +17 -0
  37. package/dist/mcp-server/tools/definitions/who-list-indicators.tool.d.ts.map +1 -0
  38. package/dist/mcp-server/tools/definitions/who-list-indicators.tool.js +64 -0
  39. package/dist/mcp-server/tools/definitions/who-list-indicators.tool.js.map +1 -0
  40. package/dist/mcp-server/tools/definitions/who-query-indicator-data.tool.d.ts +58 -0
  41. package/dist/mcp-server/tools/definitions/who-query-indicator-data.tool.d.ts.map +1 -0
  42. package/dist/mcp-server/tools/definitions/who-query-indicator-data.tool.js +215 -0
  43. package/dist/mcp-server/tools/definitions/who-query-indicator-data.tool.js.map +1 -0
  44. package/dist/mcp-server/tools/definitions/who-search-indicators.tool.d.ts +23 -0
  45. package/dist/mcp-server/tools/definitions/who-search-indicators.tool.d.ts.map +1 -0
  46. package/dist/mcp-server/tools/definitions/who-search-indicators.tool.js +89 -0
  47. package/dist/mcp-server/tools/definitions/who-search-indicators.tool.js.map +1 -0
  48. package/dist/services/gho/gho-service.d.ts +50 -0
  49. package/dist/services/gho/gho-service.d.ts.map +1 -0
  50. package/dist/services/gho/gho-service.js +263 -0
  51. package/dist/services/gho/gho-service.js.map +1 -0
  52. package/dist/services/gho/types.d.ts +113 -0
  53. package/dist/services/gho/types.d.ts.map +1 -0
  54. package/dist/services/gho/types.js +6 -0
  55. package/dist/services/gho/types.js.map +1 -0
  56. package/package.json +79 -0
  57. package/server.json +99 -0
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @fileoverview Server-specific environment configuration for the WHO GHO MCP server.
3
+ * @module config/server-config
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
7
+ const ServerConfigSchema = z.object({
8
+ baseUrl: z
9
+ .string()
10
+ .url()
11
+ .default('https://ghoapi.azureedge.net/api/')
12
+ .describe('GHO OData API base URL'),
13
+ requestTimeoutMs: z.coerce
14
+ .number()
15
+ .int()
16
+ .positive()
17
+ .default(30_000)
18
+ .describe('HTTP request timeout in milliseconds'),
19
+ });
20
+ let _config;
21
+ export function getServerConfig() {
22
+ _config ??= parseEnvConfig(ServerConfigSchema, {
23
+ baseUrl: 'GHO_BASE_URL',
24
+ requestTimeoutMs: 'GHO_REQUEST_TIMEOUT_MS',
25
+ });
26
+ return _config;
27
+ }
28
+ //# sourceMappingURL=server-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,mCAAmC,CAAC;SAC5C,QAAQ,CAAC,wBAAwB,CAAC;IACrC,gBAAgB,EAAE,CAAC,CAAC,MAAM;SACvB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,OAAO,CAAC,MAAM,CAAC;SACf,QAAQ,CAAC,sCAAsC,CAAC;CACpD,CAAC,CAAC;AAEH,IAAI,OAAuD,CAAC;AAE5D,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,cAAc,CAAC,kBAAkB,EAAE;QAC7C,OAAO,EAAE,cAAc;QACvB,gBAAgB,EAAE,wBAAwB;KAC3C,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @fileoverview who-gho-mcp-server MCP server entry point.
4
+ * @module index
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG"}
package/dist/index.js ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @fileoverview who-gho-mcp-server MCP server entry point.
4
+ * @module index
5
+ */
6
+ import { createApp } from '@cyanheads/mcp-ts-core';
7
+ import { whoDimensionValuesResource } from './mcp-server/resources/definitions/who-dimension-values.resource.js';
8
+ import { whoIndicatorMetadataResource } from './mcp-server/resources/definitions/who-indicator-metadata.resource.js';
9
+ import { whoGetIndicatorMetadata } from './mcp-server/tools/definitions/who-get-indicator-metadata.tool.js';
10
+ import { whoListDimensionValues } from './mcp-server/tools/definitions/who-list-dimension-values.tool.js';
11
+ import { whoListDimensions } from './mcp-server/tools/definitions/who-list-dimensions.tool.js';
12
+ import { whoListIndicators } from './mcp-server/tools/definitions/who-list-indicators.tool.js';
13
+ import { whoQueryIndicatorData } from './mcp-server/tools/definitions/who-query-indicator-data.tool.js';
14
+ import { whoSearchIndicators } from './mcp-server/tools/definitions/who-search-indicators.tool.js';
15
+ import { initGhoService } from './services/gho/gho-service.js';
16
+ await createApp({
17
+ tools: [
18
+ whoListDimensions,
19
+ whoListDimensionValues,
20
+ whoSearchIndicators,
21
+ whoListIndicators,
22
+ whoGetIndicatorMetadata,
23
+ whoQueryIndicatorData,
24
+ ],
25
+ resources: [whoIndicatorMetadataResource, whoDimensionValuesResource],
26
+ prompts: [],
27
+ instructions: 'WHO Global Health Observatory MCP server. Primary workflow: ' +
28
+ '(1) who_search_indicators to find indicator codes by keyword, ' +
29
+ '(2) who_get_indicator_metadata to confirm valid filter dimensions, ' +
30
+ '(3) who_query_indicator_data to fetch data with country/region/year/sex filters. ' +
31
+ 'Use who_list_dimensions → who_list_dimension_values to discover valid filter codes.',
32
+ setup(core) {
33
+ initGhoService(core.config, core.storage);
34
+ },
35
+ });
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qEAAqE,CAAC;AACjH,OAAO,EAAE,4BAA4B,EAAE,MAAM,uEAAuE,CAAC;AACrH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mEAAmE,CAAC;AAC5G,OAAO,EAAE,sBAAsB,EAAE,MAAM,kEAAkE,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,4DAA4D,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,4DAA4D,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,iEAAiE,CAAC;AACxG,OAAO,EAAE,mBAAmB,EAAE,MAAM,8DAA8D,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,SAAS,CAAC;IACd,KAAK,EAAE;QACL,iBAAiB;QACjB,sBAAsB;QACtB,mBAAmB;QACnB,iBAAiB;QACjB,uBAAuB;QACvB,qBAAqB;KACtB;IACD,SAAS,EAAE,CAAC,4BAA4B,EAAE,0BAA0B,CAAC;IACrE,OAAO,EAAE,EAAE;IACX,YAAY,EACV,8DAA8D;QAC9D,gEAAgE;QAChE,qEAAqE;QACrE,mFAAmF;QACnF,qFAAqF;IACvF,KAAK,CAAC,IAAI;QACR,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @fileoverview WHO GHO dimension values resource — fetch valid values for a dimension type by URI.
3
+ * @module mcp-server/resources/definitions/who-dimension-values
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ export declare const whoDimensionValuesResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{
7
+ dimensionCode: z.ZodString;
8
+ }, z.core.$strip>, z.ZodObject<{
9
+ dimension: z.ZodString;
10
+ values: z.ZodArray<z.ZodObject<{
11
+ code: z.ZodString;
12
+ label: z.ZodString;
13
+ parentCode: z.ZodOptional<z.ZodString>;
14
+ parentLabel: z.ZodOptional<z.ZodString>;
15
+ parentDimension: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$strip>>;
17
+ }, z.core.$strip>, undefined>;
18
+ //# sourceMappingURL=who-dimension-values.resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"who-dimension-values.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/who-dimension-values.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAIrD,eAAO,MAAM,0BAA0B;;;;;;;;;;;6BAuCrC,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @fileoverview WHO GHO dimension values resource — fetch valid values for a dimension type by URI.
3
+ * @module mcp-server/resources/definitions/who-dimension-values
4
+ */
5
+ import { resource, z } from '@cyanheads/mcp-ts-core';
6
+ import { notFound } from '@cyanheads/mcp-ts-core/errors';
7
+ import { getGhoService } from '../../../services/gho/gho-service.js';
8
+ export const whoDimensionValuesResource = resource('who://dimension/{dimensionCode}/values', {
9
+ name: 'who-dimension-values',
10
+ description: 'All valid values for a WHO GHO dimension type. Stable and useful as injectable context ' +
11
+ 'when building queries with who_query_indicator_data. ' +
12
+ 'Use who_list_dimensions to discover valid dimension type codes.',
13
+ mimeType: 'application/json',
14
+ params: z.object({
15
+ dimensionCode: z
16
+ .string()
17
+ .describe('Dimension type code, e.g. "COUNTRY", "REGION", "SEX", "WORLDBANKINCOMEGROUP".'),
18
+ }),
19
+ output: z.object({
20
+ dimension: z.string().describe('The requested dimension type code.'),
21
+ values: z
22
+ .array(z
23
+ .object({
24
+ code: z.string().describe('Dimension value code.'),
25
+ label: z.string().describe('Human-readable label.'),
26
+ parentCode: z.string().optional().describe('Parent value code when hierarchical.'),
27
+ parentLabel: z.string().optional().describe('Human-readable parent label.'),
28
+ parentDimension: z.string().optional().describe('Parent dimension type.'),
29
+ })
30
+ .describe('A single valid value for this dimension type.'))
31
+ .describe('Valid values for the dimension.'),
32
+ }),
33
+ async handler(params, ctx) {
34
+ const values = await getGhoService().listDimensionValues(params.dimensionCode, ctx);
35
+ if (values.length === 0) {
36
+ throw notFound(`Dimension "${params.dimensionCode}" returned no values — it may not exist. Use who_list_dimensions to discover valid codes.`, { dimensionCode: params.dimensionCode });
37
+ }
38
+ return { dimension: params.dimensionCode, values };
39
+ },
40
+ });
41
+ //# sourceMappingURL=who-dimension-values.resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"who-dimension-values.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/who-dimension-values.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,CAAC,MAAM,0BAA0B,GAAG,QAAQ,CAAC,wCAAwC,EAAE;IAC3F,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,yFAAyF;QACzF,uDAAuD;QACvD,iEAAiE;IACnE,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,aAAa,EAAE,C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+1,16 @@
1
+ /**
2
+ * @fileoverview WHO GHO indicator metadata resource — fetch metadata by indicator code URI.
3
+ * @module mcp-server/resources/definitions/who-indicator-metadata
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ export declare const whoIndicatorMetadataResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{
7
+ indicatorCode: z.ZodString;
8
+ }, z.core.$strip>, z.ZodObject<{
9
+ indicatorCode: z.ZodString;
10
+ indicatorName: z.ZodString;
11
+ dimensions: z.ZodArray<z.ZodObject<{
12
+ dimension: z.ZodString;
13
+ dimensionName: z.ZodString;
14
+ }, z.core.$strip>>;
15
+ }, z.core.$strip>, undefined>;
16
+ //# sourceMappingURL=who-indicator-metadata.resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"who-indicator-metadata.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/who-indicator-metadata.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAIrD,eAAO,MAAM,4BAA4B;;;;;;;;;6BA6CvC,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @fileoverview WHO GHO indicator metadata resource — fetch metadata by indicator code URI.
3
+ * @module mcp-server/resources/definitions/who-indicator-metadata
4
+ */
5
+ import { resource, z } from '@cyanheads/mcp-ts-core';
6
+ import { notFound } from '@cyanheads/mcp-ts-core/errors';
7
+ import { getGhoService } from '../../../services/gho/gho-service.js';
8
+ export const whoIndicatorMetadataResource = resource('who://indicator/{indicatorCode}/metadata', {
9
+ name: 'who-indicator-metadata',
10
+ description: 'Metadata for a single WHO GHO indicator: full name and the dimension types it supports for filtering. ' +
11
+ 'Stable and suitable as injectable context before calling who_query_indicator_data.',
12
+ mimeType: 'application/json',
13
+ params: z.object({
14
+ indicatorCode: z.string().describe('Indicator code, e.g. "WHOSIS_000001".'),
15
+ }),
16
+ output: z.object({
17
+ indicatorCode: z.string().describe('Indicator code.'),
18
+ indicatorName: z.string().describe('Full indicator name.'),
19
+ dimensions: z
20
+ .array(z
21
+ .object({
22
+ dimension: z.string().describe('Dimension type code, e.g. "COUNTRY", "SEX".'),
23
+ dimensionName: z.string().describe('Human-readable dimension name.'),
24
+ })
25
+ .describe('A dimension entry supported by this indicator.'))
26
+ .describe('Dimensions this indicator supports.'),
27
+ }),
28
+ async handler(params, ctx) {
29
+ const dimMap = await getGhoService().getIndicatorDimensions([params.indicatorCode], ctx);
30
+ const dims = dimMap.get(params.indicatorCode);
31
+ if (!dims) {
32
+ throw notFound(`Indicator "${params.indicatorCode}" has no metadata — it may not exist. Use who_search_indicators to find valid codes.`, { indicatorCode: params.indicatorCode });
33
+ }
34
+ // Look up name
35
+ const nameResult = await getGhoService().listIndicators({ query: params.indicatorCode, limit: 5, offset: 0 }, ctx);
36
+ const match = nameResult.indicators.find((i) => i.indicatorCode === params.indicatorCode);
37
+ return {
38
+ indicatorCode: params.indicatorCode,
39
+ indicatorName: match?.indicatorName ?? params.indicatorCode,
40
+ dimensions: dims,
41
+ };
42
+ },
43
+ });
44
+ //# sourceMappingURL=who-indicator-metadata.resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"who-indicator-metadata.resource.js","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/who-indicator-metadata.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,CAAC,MAAM,4BAA4B,GAAG,QAAQ,CAAC,0CAA0C,EAAE;IAC/F,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EACT,wGAAwG;QACxG,oFAAoF;IACtF,QAAQ,EAAE,kBAAkB;IAC5B,MAAM,EAAE,CAAC,CA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AC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,MAAM,CAAC,aAAa,CAAC,CAAC;QAC1F,OAAO;YACL,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,aAAa,EAAE,KAAK,EAAE,aAAa,IAAI,MAAM,CAAC,aAAa;YAC3D,UAAU,EAAE,IAAI;SACjB,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @fileoverview Fetch dimension metadata for one or more WHO GHO indicator codes.
3
+ * @module mcp-server/tools/definitions/who-get-indicator-metadata
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ export declare const whoGetIndicatorMetadata: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
8
+ indicator_codes: z.ZodArray<z.ZodString>;
9
+ }, z.core.$strip>, z.ZodObject<{
10
+ indicators: z.ZodArray<z.ZodObject<{
11
+ indicatorCode: z.ZodString;
12
+ indicatorName: z.ZodString;
13
+ dimensions: z.ZodArray<z.ZodObject<{
14
+ dimension: z.ZodString;
15
+ dimensionName: z.ZodString;
16
+ }, z.core.$strip>>;
17
+ }, z.core.$strip>>;
18
+ notFound: z.ZodArray<z.ZodString>;
19
+ }, z.core.$strip>, readonly [{
20
+ readonly reason: "all_not_found";
21
+ readonly code: JsonRpcErrorCode.NotFound;
22
+ readonly when: "All requested indicator codes returned empty metadata.";
23
+ readonly recovery: "Use who_search_indicators to find valid indicator codes matching your topic and retry.";
24
+ }]>;
25
+ //# sourceMappingURL=who-get-indicator-metadata.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"who-get-indicator-metadata.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/who-get-indicator-metadata.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;GAoIlC,CAAC"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * @fileoverview Fetch dimension metadata for one or more WHO GHO indicator codes.
3
+ * @module mcp-server/tools/definitions/who-get-indicator-metadata
4
+ */
5
+ import { tool, z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ import { getGhoService } from '../../../services/gho/gho-service.js';
8
+ export const whoGetIndicatorMetadata = tool('who_get_indicator_metadata', {
9
+ title: 'Get WHO GHO Indicator Metadata',
10
+ description: 'Fetch metadata for one or more WHO GHO indicator codes: the full indicator name and the dimensions ' +
11
+ 'it supports (e.g. COUNTRY, REGION, SEX, YEAR, WORLDBANKINCOMEGROUP, AGEGROUP). ' +
12
+ 'Call this before querying data with who_query_indicator_data to confirm which filter dimensions ' +
13
+ 'are valid for a given indicator. Accepts up to 10 codes per call. ' +
14
+ 'Codes with no metadata are reported in the notFound array rather than causing an error.',
15
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
16
+ input: z.object({
17
+ indicator_codes: z
18
+ .array(z.string().min(1))
19
+ .min(1)
20
+ .max(10)
21
+ .describe('One to ten indicator codes, e.g. ["WHOSIS_000001", "MDG_0000000026"].'),
22
+ }),
23
+ output: z.object({
24
+ indicators: z
25
+ .array(z
26
+ .object({
27
+ indicatorCode: z.string().describe('Indicator code.'),
28
+ indicatorName: z
29
+ .string()
30
+ .describe('Full indicator name as returned by the GHO catalog.'),
31
+ dimensions: z
32
+ .array(z
33
+ .object({
34
+ dimension: z
35
+ .string()
36
+ .describe('Dimension type code, e.g. "COUNTRY", "SEX", "WORLDBANKINCOMEGROUP".'),
37
+ dimensionName: z
38
+ .string()
39
+ .describe('Human-readable dimension name, e.g. "Country", "Sex".'),
40
+ })
41
+ .describe('A dimension entry supported by this indicator.'))
42
+ .describe('Dimensions this indicator supports for filtering in who_query_indicator_data.'),
43
+ })
44
+ .describe('Metadata for one indicator.'))
45
+ .describe('Metadata for each code that returned results.'),
46
+ notFound: z
47
+ .array(z.string())
48
+ .describe('Indicator codes that returned no metadata — they may not exist in the GHO catalog.'),
49
+ }),
50
+ errors: [
51
+ {
52
+ reason: 'all_not_found',
53
+ code: JsonRpcErrorCode.NotFound,
54
+ when: 'All requested indicator codes returned empty metadata.',
55
+ recovery: 'Use who_search_indicators to find valid indicator codes matching your topic and retry.',
56
+ },
57
+ ],
58
+ async handler(input, ctx) {
59
+ ctx.log.info('Fetching indicator metadata', { codes: input.indicator_codes });
60
+ // Fan out all lookups in parallel: dimension metadata + indicator names (one search per code)
61
+ const [dimMap, ...nameResults] = await Promise.all([
62
+ getGhoService().getIndicatorDimensions(input.indicator_codes, ctx),
63
+ ...input.indicator_codes.map((code) => getGhoService().listIndicators({ query: code, limit: 5, offset: 0 }, ctx)),
64
+ ]);
65
+ // Build name map from search results
66
+ const nameMap = new Map();
67
+ for (let i = 0; i < input.indicator_codes.length; i++) {
68
+ const code = input.indicator_codes[i];
69
+ const result = nameResults[i];
70
+ if (code && result && 'indicators' in result) {
71
+ const match = result.indicators.find((ind) => ind.indicatorCode === code);
72
+ if (match)
73
+ nameMap.set(code, match.indicatorName);
74
+ }
75
+ }
76
+ const found = [];
77
+ const notFound = [];
78
+ for (const code of input.indicator_codes) {
79
+ const dims = dimMap.get(code);
80
+ if (!dims) {
81
+ notFound.push(code);
82
+ }
83
+ else {
84
+ found.push({
85
+ indicatorCode: code,
86
+ indicatorName: nameMap.get(code) ?? code,
87
+ dimensions: dims,
88
+ });
89
+ }
90
+ }
91
+ if (found.length === 0) {
92
+ throw ctx.fail('all_not_found', `None of the requested indicator codes returned metadata.`, {
93
+ codes: input.indicator_codes,
94
+ ...ctx.recoveryFor('all_not_found'),
95
+ });
96
+ }
97
+ return { indicators: found, notFound };
98
+ },
99
+ format: (result) => {
100
+ const lines = [];
101
+ for (const ind of result.indicators) {
102
+ lines.push(`## ${ind.indicatorCode}: ${ind.indicatorName}`);
103
+ lines.push(`**Dimensions:** ${ind.dimensions.map((d) => `${d.dimension} (${d.dimensionName})`).join(', ')}`);
104
+ lines.push('');
105
+ }
106
+ if (result.notFound.length > 0) {
107
+ lines.push(`**Not found:** ${result.notFound.join(', ')}`);
108
+ }
109
+ return [{ type: 'text', text: lines.join('\n').trimEnd() }];
110
+ },
111
+ });
112
+ //# sourceMappingURL=who-get-indicator-metadata.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"who-get-indicator-metadata.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/who-get-indicator-metadata.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC,4BAA4B,EAAE;IACxE,KAAK,EAAE,gCAAgC;IACvC,WAAW,EACT,qGAAqG;QACrG,iFAAiF;QACjF,kGAAkG;QAClG,oEAAoE;QACpE,yFAAyF;IAC3F,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE;IAC/E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,eAAe,EAAE,CAAC;aACf,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;aACxB,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,EAAE,CAAC;aACP,QAAQ,CAAC,uEAAuE,CAAC;KACrF,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,UA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AC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @fileoverview List valid values for a WHO GHO dimension type.
3
+ * @module mcp-server/tools/definitions/who-list-dimension-values
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ export declare const whoListDimensionValues: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
8
+ dimension: z.ZodString;
9
+ }, z.core.$strip>, z.ZodObject<{
10
+ dimension: z.ZodString;
11
+ values: z.ZodArray<z.ZodObject<{
12
+ code: z.ZodString;
13
+ label: z.ZodString;
14
+ parentCode: z.ZodOptional<z.ZodString>;
15
+ parentLabel: z.ZodOptional<z.ZodString>;
16
+ parentDimension: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>>;
18
+ }, z.core.$strip>, readonly [{
19
+ readonly reason: "dimension_not_found";
20
+ readonly code: JsonRpcErrorCode.NotFound;
21
+ readonly when: "The dimension code returned no values — it may not exist in the GHO catalog.";
22
+ readonly recovery: "Use who_list_dimensions to discover valid dimension type codes and retry with a correct code.";
23
+ }]>;
24
+ //# sourceMappingURL=who-list-dimension-values.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"who-list-dimension-values.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/who-list-dimension-values.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;GAgFjC,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @fileoverview List valid values for a WHO GHO dimension type.
3
+ * @module mcp-server/tools/definitions/who-list-dimension-values
4
+ */
5
+ import { tool, z } from '@cyanheads/mcp-ts-core';
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ import { getGhoService } from '../../../services/gho/gho-service.js';
8
+ export const whoListDimensionValues = tool('who_list_dimension_values', {
9
+ title: 'List GHO Dimension Values',
10
+ description: 'List valid codes and labels for a WHO GHO dimension type such as COUNTRY, REGION, SEX, ' +
11
+ 'WORLDBANKINCOMEGROUP, or AGEGROUP. Use this to discover valid filter values before calling ' +
12
+ 'who_query_indicator_data, or to confirm the correct ISO code for a country. ' +
13
+ 'Use who_list_dimensions to discover all available dimension type codes.',
14
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
15
+ input: z.object({
16
+ dimension: z
17
+ .string()
18
+ .min(1)
19
+ .describe('Dimension type code. Use who_list_dimensions to discover all available codes. ' +
20
+ 'Common values: COUNTRY, REGION, SEX, WORLDBANKINCOMEGROUP, AGEGROUP.'),
21
+ }),
22
+ output: z.object({
23
+ dimension: z.string().describe('The requested dimension type code.'),
24
+ values: z
25
+ .array(z
26
+ .object({
27
+ code: z
28
+ .string()
29
+ .describe('Dimension value code used as a filter in who_query_indicator_data.'),
30
+ label: z.string().describe('Human-readable label for this value.'),
31
+ parentCode: z
32
+ .string()
33
+ .optional()
34
+ .describe('Parent value code, e.g. the WHO region code for a country entry.'),
35
+ parentLabel: z
36
+ .string()
37
+ .optional()
38
+ .describe('Human-readable label for the parent value.'),
39
+ parentDimension: z
40
+ .string()
41
+ .optional()
42
+ .describe('Parent dimension type, e.g. "REGION" for country entries.'),
43
+ })
44
+ .describe('A single valid value for this dimension type.'))
45
+ .describe('Valid values for this dimension type.'),
46
+ }),
47
+ errors: [
48
+ {
49
+ reason: 'dimension_not_found',
50
+ code: JsonRpcErrorCode.NotFound,
51
+ when: 'The dimension code returned no values — it may not exist in the GHO catalog.',
52
+ recovery: 'Use who_list_dimensions to discover valid dimension type codes and retry with a correct code.',
53
+ },
54
+ ],
55
+ async handler(input, ctx) {
56
+ ctx.log.info('Fetching dimension values', { dimension: input.dimension });
57
+ const values = await getGhoService().listDimensionValues(input.dimension, ctx);
58
+ if (values.length === 0) {
59
+ throw ctx.fail('dimension_not_found', `Dimension "${input.dimension}" returned no values — it may not exist.`, {
60
+ ...ctx.recoveryFor('dimension_not_found'),
61
+ });
62
+ }
63
+ return { dimension: input.dimension, values };
64
+ },
65
+ format: (result) => {
66
+ const lines = [`**Dimension: ${result.dimension}** (${result.values.length} values)`, ''];
67
+ for (const v of result.values) {
68
+ const parentCode = v.parentCode ? ` parentCode=${v.parentCode}` : '';
69
+ const parentLabel = v.parentLabel ? ` parentLabel=${v.parentLabel}` : '';
70
+ const parentDimension = v.parentDimension ? ` parentDimension=${v.parentDimension}` : '';
71
+ lines.push(`- **${v.code}**: ${v.label}${parentCode}${parentLabel}${parentDimension}`);
72
+ }
73
+ return [{ type: 'text', text: lines.join('\n') }];
74
+ },
75
+ });
76
+ //# sourceMappingURL=who-list-dimension-values.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"who-list-dimension-values.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/who-list-dimension-values.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,2BAA2B,EAAE;IACtE,KAAK,EAAE,2BAA2B;IAClC,WAAW,EACT,yFAAyF;QACzF,6FAA6F;QAC7F,8EAA8E;QAC9E,yEAAyE;IAC3E,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE;IAC/E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,gF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*/
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ export declare const whoListDimensions: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
7
+ dimensions: z.ZodArray<z.ZodObject<{
8
+ code: z.ZodString;
9
+ title: z.ZodString;
10
+ }, z.core.$strip>>;
11
+ }, z.core.$strip>, undefined>;
12
+ //# sourceMappingURL=who-list-dimensions.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"who-list-dimensions.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/who-list-dimensions.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAGjD,eAAO,MAAM,iBAAiB;;;;;6BAmC5B,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @fileoverview List all dimension type codes available in the WHO GHO API.
3
+ * @module mcp-server/tools/definitions/who-list-dimensions
4
+ */
5
+ import { tool, z } from '@cyanheads/mcp-ts-core';
6
+ import { getGhoService } from '../../../services/gho/gho-service.js';
7
+ export const whoListDimensions = tool('who_list_dimensions', {
8
+ title: 'List GHO Dimension Types',
9
+ description: 'List all dimension type codes and human-readable titles available in the WHO Global Health Observatory API. ' +
10
+ 'Use this to discover valid dimension codes before calling who_list_dimension_values. ' +
11
+ 'Common dimensions include COUNTRY, REGION, SEX, WORLDBANKINCOMEGROUP, and AGEGROUP, ' +
12
+ 'but many additional types exist — this endpoint exposes them all.',
13
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
14
+ input: z.object({}),
15
+ output: z.object({
16
+ dimensions: z
17
+ .array(z
18
+ .object({
19
+ code: z.string().describe('Dimension type code, e.g. "COUNTRY", "SEX", "AGEGROUP".'),
20
+ title: z.string().describe('Human-readable label for the dimension, e.g. "Age Group".'),
21
+ })
22
+ .describe('A single dimension type entry.'))
23
+ .describe('All available dimension types in the GHO catalog.'),
24
+ }),
25
+ async handler(_input, ctx) {
26
+ ctx.log.info('Fetching GHO dimension list');
27
+ const dimensions = await getGhoService().listDimensions(ctx);
28
+ return { dimensions };
29
+ },
30
+ format: (result) => {
31
+ const lines = [`**Dimension types (${result.dimensions.length} total):**`, ''];
32
+ for (const d of result.dimensions) {
33
+ lines.push(`- **${d.code}**: ${d.title}`);
34
+ }
35
+ return [{ type: 'text', text: lines.join('\n') }];
36
+ },
37
+ });
38
+ //# sourceMappingURL=who-list-dimensions.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"who-list-dimensions.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/who-list-dimensions.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,qBAAqB,EAAE;IAC3D,KAAK,EAAE,0BAA0B;IACjC,WAAW,EACT,8GAA8G;QAC9G,uFAAuF;QACvF,sFAAsF;QACtF,mEAAmE;IACrE,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE;IAC/E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACnB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,UAAU,EAAE,CAAC;aACV,KAAK,CACJ,CAAC;aACE,MAAM,CAAC;YACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;YACpF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2DAA2D,CAAC;SACxF,CAAC;aACD,QAAQ,CAAC,gCAAgC,CAAC,CAC9C;aACA,QAAQ,CAAC,mDAAmD,CAAC;KACjE,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QACvB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAC5C,MAAM,UAAU,GAAG,MAAM,aAAa,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,EAAE,UAAU,EAAE,CAAC;IACxB,CAAC;IAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;QACjB,MAAM,KAAK,GAAG,CAAC,sBAAsB,MAAM,CAAC,UAAU,CAAC,MAAM,YAAY,EAAE,EAAE,CAAC,CAAC;QAC/E,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @fileoverview Browse the WHO GHO indicator catalog with pagination.
3
+ * @module mcp-server/tools/definitions/who-list-indicators
4
+ */
5
+ import { z } from '@cyanheads/mcp-ts-core';
6
+ export declare const whoListIndicators: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
7
+ limit: z.ZodDefault<z.ZodNumber>;
8
+ offset: z.ZodDefault<z.ZodNumber>;
9
+ }, z.core.$strip>, z.ZodObject<{
10
+ indicators: z.ZodArray<z.ZodObject<{
11
+ indicatorCode: z.ZodString;
12
+ indicatorName: z.ZodString;
13
+ }, z.core.$strip>>;
14
+ total: z.ZodNumber;
15
+ hasMore: z.ZodBoolean;
16
+ }, z.core.$strip>, undefined>;
17
+ //# sourceMappingURL=who-list-indicators.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"who-list-indicators.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/who-list-indicators.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAGjD,eAAO,MAAM,iBAAiB;;;;;;;;;;6BAkE5B,CAAC"}