@takeshape/schema 11.92.0 → 11.94.3

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.
package/dist/agents.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AgentAPI, AgentAPIArgument, AgentJSON, Args, ProjectSchemaJSON } from './project-schema/index.ts';
1
+ import type { AgentAPI, AgentAPIArgument, AgentJSON, Args, GuardJSON, ProjectSchemaJSON } from './project-schema/index.ts';
2
2
  /**
3
3
  * Special transition destination ID for agent transitions that end the agent execution.
4
4
  */
@@ -20,3 +20,19 @@ export declare const removeBuiltInArgs: (args: AgentAPIArgument[]) => AgentAPIAr
20
20
  export declare function getAgentApiArgs(api: AgentAPI): AgentAPIArgument[];
21
21
  export declare const createArgs: (agent: AgentJSON) => Args | undefined;
22
22
  export declare function addAiQueries(projectSchema: ProjectSchemaJSON): ProjectSchemaJSON;
23
+ /**
24
+ * Where guards live in the schema.
25
+ */
26
+ export declare const GUARDS_SCHEMA_PATH: readonly ["ai-experimental", "guards"];
27
+ /**
28
+ * Check if a guard is enabled.
29
+ */
30
+ export declare const isGuardEnabled: (guard: GuardJSON | undefined) => boolean;
31
+ /**
32
+ * Get a guard configuration from the project schema.
33
+ */
34
+ export declare function getGuardConfig(schema: ProjectSchemaJSON, guardId: string): GuardJSON | undefined;
35
+ /**
36
+ * Get a guard configuration from the project schema, but only if it is enabled.
37
+ */
38
+ export declare function getEnabledGuardConfig(schema: ProjectSchemaJSON, guardId: string): GuardJSON | undefined;
package/dist/agents.js CHANGED
@@ -1,3 +1,4 @@
1
+ import get from 'lodash/get.js';
1
2
  import uniq from 'lodash/uniq.js';
2
3
  import uniqBy from 'lodash/uniqBy.js';
3
4
  import upperFirst from 'lodash/upperFirst.js';
@@ -144,3 +145,28 @@ export function addAiQueries(projectSchema) {
144
145
  }
145
146
  return newSchema;
146
147
  }
148
+ /**
149
+ * Where guards live in the schema.
150
+ */
151
+ export const GUARDS_SCHEMA_PATH = ['ai-experimental', 'guards'];
152
+ /**
153
+ * Check if a guard is enabled.
154
+ */
155
+ export const isGuardEnabled = (guard) => {
156
+ return Boolean(guard && guard.enabled !== false);
157
+ };
158
+ /**
159
+ * Get a guard configuration from the project schema.
160
+ */
161
+ export function getGuardConfig(schema, guardId) {
162
+ return get(schema, [...GUARDS_SCHEMA_PATH, guardId]);
163
+ }
164
+ /**
165
+ * Get a guard configuration from the project schema, but only if it is enabled.
166
+ */
167
+ export function getEnabledGuardConfig(schema, guardId) {
168
+ const config = getGuardConfig(schema, guardId);
169
+ if (config && isGuardEnabled(config)) {
170
+ return config;
171
+ }
172
+ }
package/dist/index.d.ts CHANGED
@@ -44,6 +44,7 @@ export * from './util/get-conflicting-properties.ts';
44
44
  export * from './util/get-return-shape.ts';
45
45
  export * from './util/has-arg.ts';
46
46
  export * from './util/is-asset-property.ts';
47
+ export * from './util/mcp.ts';
47
48
  export * from './util/merge.ts';
48
49
  export * from './util/patch-schema.ts';
49
50
  export * from './util/shapes.ts';
package/dist/index.js CHANGED
@@ -42,6 +42,7 @@ export * from "./util/get-conflicting-properties.js";
42
42
  export * from "./util/get-return-shape.js";
43
43
  export * from "./util/has-arg.js";
44
44
  export * from "./util/is-asset-property.js";
45
+ export * from "./util/mcp.js";
45
46
  export * from "./util/merge.js";
46
47
  export * from "./util/patch-schema.js";
47
48
  export * from "./util/shapes.js";
@@ -11,7 +11,7 @@ export type ProjectSchemaUpdate = {
11
11
  shapes?: Record<string, ShapeJSON | null>;
12
12
  'ai-experimental.agents'?: Record<string, AgentJSON | null>;
13
13
  'ai-experimental.guards'?: Record<string, GuardJSON | null>;
14
- 'ai-experimental.tools'?: Record<string, ToolJSON | null>;
14
+ 'ai-experimental.mcp.tools'?: Record<string, ToolJSON | null>;
15
15
  forms?: Record<string, FormConfig | null>;
16
16
  workflows?: Record<string, Workflow | null>;
17
17
  services?: Record<string, ServiceConfigJSON | null>;
@@ -373,6 +373,10 @@ export type Name = string;
373
373
  * A description of the Guard.
374
374
  */
375
375
  export type Description = string;
376
+ /**
377
+ * Guards will not run unless enabled.
378
+ */
379
+ export type Enabled = boolean;
376
380
  /**
377
381
  * The remote id of the Guardrail.
378
382
  */
@@ -1745,7 +1749,7 @@ export interface ShapeSchemaAny {
1745
1749
  export interface AIExperimental {
1746
1750
  agents?: AgentMap;
1747
1751
  guards?: GuardMap;
1748
- tools?: ToolMap;
1752
+ mcp?: MCPServerConfiguration;
1749
1753
  }
1750
1754
  export interface AgentMap {
1751
1755
  [k: string]: AgentJSON;
@@ -1964,6 +1968,7 @@ export interface GuardMap {
1964
1968
  export interface GuardJSON {
1965
1969
  name: Name;
1966
1970
  description?: Description;
1971
+ enabled?: Enabled;
1967
1972
  guardrailIdentifier?: GuardrailIdentifier;
1968
1973
  guardrailVersion?: GuardrailVersion;
1969
1974
  blockedInputMessaging?: BlockedInputMessaging;
@@ -2006,6 +2011,9 @@ export interface SensitiveInformationPolicy {
2006
2011
  export interface ContextualGroundingPolicy {
2007
2012
  filtersConfig: Filter1;
2008
2013
  }
2014
+ export interface MCPServerConfiguration {
2015
+ tools?: ToolMap;
2016
+ }
2009
2017
  export interface ToolMap {
2010
2018
  [k: string]: ToolJSON;
2011
2019
  }
@@ -348,6 +348,10 @@ export type NameV3_48_0 = string;
348
348
  * A description of the Guard.
349
349
  */
350
350
  export type DescriptionV3_48_0 = string;
351
+ /**
352
+ * Guards will not run unless enabled.
353
+ */
354
+ export type EnabledV3_48_0 = boolean;
351
355
  /**
352
356
  * The remote id of the Guardrail.
353
357
  */
@@ -1593,7 +1597,7 @@ export interface ShapeSchemaAnyV3_48_0 {
1593
1597
  export interface AIExperimentalV3_48_0 {
1594
1598
  agents?: AgentMapV3_48_0;
1595
1599
  guards?: GuardMapV3_48_0;
1596
- tools?: ToolMapV3_48_0;
1600
+ mcp?: MCPServerConfigurationV3_48_0;
1597
1601
  }
1598
1602
  export interface AgentMapV3_48_0 {
1599
1603
  [k: string]: AgentJSONV3_48_0;
@@ -1812,6 +1816,7 @@ export interface GuardMapV3_48_0 {
1812
1816
  export interface GuardJSONV3_48_0 {
1813
1817
  name: NameV3_48_0;
1814
1818
  description?: DescriptionV3_48_0;
1819
+ enabled?: EnabledV3_48_0;
1815
1820
  guardrailIdentifier?: GuardrailIdentifierV3_48_0;
1816
1821
  guardrailVersion?: GuardrailVersionV3_48_0;
1817
1822
  blockedInputMessaging?: BlockedInputMessagingV3_48_0;
@@ -1854,6 +1859,9 @@ export interface SensitiveInformationPolicyV3_48_0 {
1854
1859
  export interface ContextualGroundingPolicyV3_48_0 {
1855
1860
  filtersConfig: FilterV3_48_01;
1856
1861
  }
1862
+ export interface MCPServerConfigurationV3_48_0 {
1863
+ tools?: ToolMapV3_48_0;
1864
+ }
1857
1865
  export interface ToolMapV3_48_0 {
1858
1866
  [k: string]: ToolJSONV3_48_0;
1859
1867
  }
@@ -348,6 +348,10 @@ export type NameV3_49_0 = string;
348
348
  * A description of the Guard.
349
349
  */
350
350
  export type DescriptionV3_49_0 = string;
351
+ /**
352
+ * Guards will not run unless enabled.
353
+ */
354
+ export type EnabledV3_49_0 = boolean;
351
355
  /**
352
356
  * The remote id of the Guardrail.
353
357
  */
@@ -1593,7 +1597,7 @@ export interface ShapeSchemaAnyV3_49_0 {
1593
1597
  export interface AIExperimentalV3_49_0 {
1594
1598
  agents?: AgentMapV3_49_0;
1595
1599
  guards?: GuardMapV3_49_0;
1596
- tools?: ToolMapV3_49_0;
1600
+ mcp?: MCPServerConfigurationV3_49_0;
1597
1601
  }
1598
1602
  export interface AgentMapV3_49_0 {
1599
1603
  [k: string]: AgentJSONV3_49_0;
@@ -1812,6 +1816,7 @@ export interface GuardMapV3_49_0 {
1812
1816
  export interface GuardJSONV3_49_0 {
1813
1817
  name: NameV3_49_0;
1814
1818
  description?: DescriptionV3_49_0;
1819
+ enabled?: EnabledV3_49_0;
1815
1820
  guardrailIdentifier?: GuardrailIdentifierV3_49_0;
1816
1821
  guardrailVersion?: GuardrailVersionV3_49_0;
1817
1822
  blockedInputMessaging?: BlockedInputMessagingV3_49_0;
@@ -1854,6 +1859,9 @@ export interface SensitiveInformationPolicyV3_49_0 {
1854
1859
  export interface ContextualGroundingPolicyV3_49_0 {
1855
1860
  filtersConfig: FilterV3_49_01;
1856
1861
  }
1862
+ export interface MCPServerConfigurationV3_49_0 {
1863
+ tools?: ToolMapV3_49_0;
1864
+ }
1857
1865
  export interface ToolMapV3_49_0 {
1858
1866
  [k: string]: ToolJSONV3_49_0;
1859
1867
  }
@@ -360,6 +360,10 @@ export type NameV3_50_0 = string;
360
360
  * A description of the Guard.
361
361
  */
362
362
  export type DescriptionV3_50_0 = string;
363
+ /**
364
+ * Guards will not run unless enabled.
365
+ */
366
+ export type EnabledV3_50_0 = boolean;
363
367
  /**
364
368
  * The remote id of the Guardrail.
365
369
  */
@@ -1645,7 +1649,7 @@ export interface ShapeSchemaAnyV3_50_0 {
1645
1649
  export interface AIExperimentalV3_50_0 {
1646
1650
  agents?: AgentMapV3_50_0;
1647
1651
  guards?: GuardMapV3_50_0;
1648
- tools?: ToolMapV3_50_0;
1652
+ mcp?: MCPServerConfigurationV3_50_0;
1649
1653
  }
1650
1654
  export interface AgentMapV3_50_0 {
1651
1655
  [k: string]: AgentJSONV3_50_0;
@@ -1864,6 +1868,7 @@ export interface GuardMapV3_50_0 {
1864
1868
  export interface GuardJSONV3_50_0 {
1865
1869
  name: NameV3_50_0;
1866
1870
  description?: DescriptionV3_50_0;
1871
+ enabled?: EnabledV3_50_0;
1867
1872
  guardrailIdentifier?: GuardrailIdentifierV3_50_0;
1868
1873
  guardrailVersion?: GuardrailVersionV3_50_0;
1869
1874
  blockedInputMessaging?: BlockedInputMessagingV3_50_0;
@@ -1906,6 +1911,9 @@ export interface SensitiveInformationPolicyV3_50_0 {
1906
1911
  export interface ContextualGroundingPolicyV3_50_0 {
1907
1912
  filtersConfig: FilterV3_50_01;
1908
1913
  }
1914
+ export interface MCPServerConfigurationV3_50_0 {
1915
+ tools?: ToolMapV3_50_0;
1916
+ }
1909
1917
  export interface ToolMapV3_50_0 {
1910
1918
  [k: string]: ToolJSONV3_50_0;
1911
1919
  }
@@ -360,6 +360,10 @@ export type NameV3_51_0 = string;
360
360
  * A description of the Guard.
361
361
  */
362
362
  export type DescriptionV3_51_0 = string;
363
+ /**
364
+ * Guards will not run unless enabled.
365
+ */
366
+ export type EnabledV3_51_0 = boolean;
363
367
  /**
364
368
  * The remote id of the Guardrail.
365
369
  */
@@ -1645,7 +1649,7 @@ export interface ShapeSchemaAnyV3_51_0 {
1645
1649
  export interface AIExperimentalV3_51_0 {
1646
1650
  agents?: AgentMapV3_51_0;
1647
1651
  guards?: GuardMapV3_51_0;
1648
- tools?: ToolMapV3_51_0;
1652
+ mcp?: MCPServerConfigurationV3_51_0;
1649
1653
  }
1650
1654
  export interface AgentMapV3_51_0 {
1651
1655
  [k: string]: AgentJSONV3_51_0;
@@ -1864,6 +1868,7 @@ export interface GuardMapV3_51_0 {
1864
1868
  export interface GuardJSONV3_51_0 {
1865
1869
  name: NameV3_51_0;
1866
1870
  description?: DescriptionV3_51_0;
1871
+ enabled?: EnabledV3_51_0;
1867
1872
  guardrailIdentifier?: GuardrailIdentifierV3_51_0;
1868
1873
  guardrailVersion?: GuardrailVersionV3_51_0;
1869
1874
  blockedInputMessaging?: BlockedInputMessagingV3_51_0;
@@ -1906,6 +1911,9 @@ export interface SensitiveInformationPolicyV3_51_0 {
1906
1911
  export interface ContextualGroundingPolicyV3_51_0 {
1907
1912
  filtersConfig: FilterV3_51_01;
1908
1913
  }
1914
+ export interface MCPServerConfigurationV3_51_0 {
1915
+ tools?: ToolMapV3_51_0;
1916
+ }
1909
1917
  export interface ToolMapV3_51_0 {
1910
1918
  [k: string]: ToolJSONV3_51_0;
1911
1919
  }
@@ -360,6 +360,10 @@ export type NameV3_52_0 = string;
360
360
  * A description of the Guard.
361
361
  */
362
362
  export type DescriptionV3_52_0 = string;
363
+ /**
364
+ * Guards will not run unless enabled.
365
+ */
366
+ export type EnabledV3_52_0 = boolean;
363
367
  /**
364
368
  * The remote id of the Guardrail.
365
369
  */
@@ -1645,7 +1649,7 @@ export interface ShapeSchemaAnyV3_52_0 {
1645
1649
  export interface AIExperimentalV3_52_0 {
1646
1650
  agents?: AgentMapV3_52_0;
1647
1651
  guards?: GuardMapV3_52_0;
1648
- tools?: ToolMapV3_52_0;
1652
+ mcp?: MCPServerConfigurationV3_52_0;
1649
1653
  }
1650
1654
  export interface AgentMapV3_52_0 {
1651
1655
  [k: string]: AgentJSONV3_52_0;
@@ -1864,6 +1868,7 @@ export interface GuardMapV3_52_0 {
1864
1868
  export interface GuardJSONV3_52_0 {
1865
1869
  name: NameV3_52_0;
1866
1870
  description?: DescriptionV3_52_0;
1871
+ enabled?: EnabledV3_52_0;
1867
1872
  guardrailIdentifier?: GuardrailIdentifierV3_52_0;
1868
1873
  guardrailVersion?: GuardrailVersionV3_52_0;
1869
1874
  blockedInputMessaging?: BlockedInputMessagingV3_52_0;
@@ -1906,6 +1911,9 @@ export interface SensitiveInformationPolicyV3_52_0 {
1906
1911
  export interface ContextualGroundingPolicyV3_52_0 {
1907
1912
  filtersConfig: FilterV3_52_01;
1908
1913
  }
1914
+ export interface MCPServerConfigurationV3_52_0 {
1915
+ tools?: ToolMapV3_52_0;
1916
+ }
1909
1917
  export interface ToolMapV3_52_0 {
1910
1918
  [k: string]: ToolJSONV3_52_0;
1911
1919
  }
@@ -369,6 +369,10 @@ export type NameV3_53_0 = string;
369
369
  * A description of the Guard.
370
370
  */
371
371
  export type DescriptionV3_53_0 = string;
372
+ /**
373
+ * Guards will not run unless enabled.
374
+ */
375
+ export type EnabledV3_53_0 = boolean;
372
376
  /**
373
377
  * The remote id of the Guardrail.
374
378
  */
@@ -1726,7 +1730,7 @@ export interface ShapeSchemaAnyV3_53_0 {
1726
1730
  export interface AIExperimentalV3_53_0 {
1727
1731
  agents?: AgentMapV3_53_0;
1728
1732
  guards?: GuardMapV3_53_0;
1729
- tools?: ToolMapV3_53_0;
1733
+ mcp?: MCPServerConfigurationV3_53_0;
1730
1734
  }
1731
1735
  export interface AgentMapV3_53_0 {
1732
1736
  [k: string]: AgentJSONV3_53_0;
@@ -1945,6 +1949,7 @@ export interface GuardMapV3_53_0 {
1945
1949
  export interface GuardJSONV3_53_0 {
1946
1950
  name: NameV3_53_0;
1947
1951
  description?: DescriptionV3_53_0;
1952
+ enabled?: EnabledV3_53_0;
1948
1953
  guardrailIdentifier?: GuardrailIdentifierV3_53_0;
1949
1954
  guardrailVersion?: GuardrailVersionV3_53_0;
1950
1955
  blockedInputMessaging?: BlockedInputMessagingV3_53_0;
@@ -1987,6 +1992,9 @@ export interface SensitiveInformationPolicyV3_53_0 {
1987
1992
  export interface ContextualGroundingPolicyV3_53_0 {
1988
1993
  filtersConfig: FilterV3_53_01;
1989
1994
  }
1995
+ export interface MCPServerConfigurationV3_53_0 {
1996
+ tools?: ToolMapV3_53_0;
1997
+ }
1990
1998
  export interface ToolMapV3_53_0 {
1991
1999
  [k: string]: ToolJSONV3_53_0;
1992
2000
  }
@@ -373,6 +373,10 @@ export type NameV3_54_0 = string;
373
373
  * A description of the Guard.
374
374
  */
375
375
  export type DescriptionV3_54_0 = string;
376
+ /**
377
+ * Guards will not run unless enabled.
378
+ */
379
+ export type EnabledV3_54_0 = boolean;
376
380
  /**
377
381
  * The remote id of the Guardrail.
378
382
  */
@@ -1745,7 +1749,7 @@ export interface ShapeSchemaAnyV3_54_0 {
1745
1749
  export interface AIExperimentalV3_54_0 {
1746
1750
  agents?: AgentMapV3_54_0;
1747
1751
  guards?: GuardMapV3_54_0;
1748
- tools?: ToolMapV3_54_0;
1752
+ mcp?: MCPServerConfigurationV3_54_0;
1749
1753
  }
1750
1754
  export interface AgentMapV3_54_0 {
1751
1755
  [k: string]: AgentJSONV3_54_0;
@@ -1964,6 +1968,7 @@ export interface GuardMapV3_54_0 {
1964
1968
  export interface GuardJSONV3_54_0 {
1965
1969
  name: NameV3_54_0;
1966
1970
  description?: DescriptionV3_54_0;
1971
+ enabled?: EnabledV3_54_0;
1967
1972
  guardrailIdentifier?: GuardrailIdentifierV3_54_0;
1968
1973
  guardrailVersion?: GuardrailVersionV3_54_0;
1969
1974
  blockedInputMessaging?: BlockedInputMessagingV3_54_0;
@@ -2006,6 +2011,9 @@ export interface SensitiveInformationPolicyV3_54_0 {
2006
2011
  export interface ContextualGroundingPolicyV3_54_0 {
2007
2012
  filtersConfig: FilterV3_54_01;
2008
2013
  }
2014
+ export interface MCPServerConfigurationV3_54_0 {
2015
+ tools?: ToolMapV3_54_0;
2016
+ }
2009
2017
  export interface ToolMapV3_54_0 {
2010
2018
  [k: string]: ToolJSONV3_54_0;
2011
2019
  }
@@ -373,6 +373,10 @@ export type NameV3_55_0 = string;
373
373
  * A description of the Guard.
374
374
  */
375
375
  export type DescriptionV3_55_0 = string;
376
+ /**
377
+ * Guards will not run unless enabled.
378
+ */
379
+ export type EnabledV3_55_0 = boolean;
376
380
  /**
377
381
  * The remote id of the Guardrail.
378
382
  */
@@ -1745,7 +1749,7 @@ export interface ShapeSchemaAnyV3_55_0 {
1745
1749
  export interface AIExperimentalV3_55_0 {
1746
1750
  agents?: AgentMapV3_55_0;
1747
1751
  guards?: GuardMapV3_55_0;
1748
- tools?: ToolMapV3_55_0;
1752
+ mcp?: MCPServerConfigurationV3_55_0;
1749
1753
  }
1750
1754
  export interface AgentMapV3_55_0 {
1751
1755
  [k: string]: AgentJSONV3_55_0;
@@ -1964,6 +1968,7 @@ export interface GuardMapV3_55_0 {
1964
1968
  export interface GuardJSONV3_55_0 {
1965
1969
  name: NameV3_55_0;
1966
1970
  description?: DescriptionV3_55_0;
1971
+ enabled?: EnabledV3_55_0;
1967
1972
  guardrailIdentifier?: GuardrailIdentifierV3_55_0;
1968
1973
  guardrailVersion?: GuardrailVersionV3_55_0;
1969
1974
  blockedInputMessaging?: BlockedInputMessagingV3_55_0;
@@ -2006,6 +2011,9 @@ export interface SensitiveInformationPolicyV3_55_0 {
2006
2011
  export interface ContextualGroundingPolicyV3_55_0 {
2007
2012
  filtersConfig: FilterV3_55_01;
2008
2013
  }
2014
+ export interface MCPServerConfigurationV3_55_0 {
2015
+ tools?: ToolMapV3_55_0;
2016
+ }
2009
2017
  export interface ToolMapV3_55_0 {
2010
2018
  [k: string]: ToolJSONV3_55_0;
2011
2019
  }
@@ -823,6 +823,17 @@
823
823
  },
824
824
  "additionalProperties": false
825
825
  },
826
+ "mcpConfig": {
827
+ "title": "MCP Server Configuration",
828
+ "type": "object",
829
+ "properties": {
830
+ "tools": {
831
+ "$ref": "#/definitions/toolMap",
832
+ "description": "A Tool is a configuration for an AI tool which can query or mutate data."
833
+ }
834
+ },
835
+ "additionalProperties": false
836
+ },
826
837
  "aiExperimental": {
827
838
  "title": "AI Experimental",
828
839
  "type": "object",
@@ -835,9 +846,9 @@
835
846
  "$ref": "#/definitions/guardMap",
836
847
  "description": "A Guard is a configuration for an AI guardrail that can check inputs and outputs and provide safety and compliance."
837
848
  },
838
- "tools": {
839
- "$ref": "#/definitions/toolMap",
840
- "description": "A Tool is a configuration for an AI tool which can query or mutate data."
849
+ "mcp": {
850
+ "$ref": "#/definitions/mcpConfig",
851
+ "description": "MCP server configuration"
841
852
  }
842
853
  },
843
854
  "additionalProperties": false
@@ -879,6 +890,12 @@
879
890
  "title": "Description",
880
891
  "description": "A description of the Guard."
881
892
  },
893
+ "enabled": {
894
+ "type": "boolean",
895
+ "title": "Enabled",
896
+ "description": "Guards will not run unless enabled.",
897
+ "default": true
898
+ },
882
899
  "guardrailIdentifier": {
883
900
  "type": "string",
884
901
  "title": "Guardrail Identifier",
@@ -0,0 +1,7 @@
1
+ import type { ProjectSchemaJSON, ToolJSON, ToolMap } from '../project-schema/latest.ts';
2
+ export declare function getMcpToolMap(projectSchema: ProjectSchemaJSON): ToolMap | undefined;
3
+ export declare function getMcpTools(projectSchema: ProjectSchemaJSON): ToolJSON[] | undefined;
4
+ export declare function getMcpToolNames(projectSchema: ProjectSchemaJSON): string[];
5
+ export declare function getMcpTool(projectSchema: ProjectSchemaJSON, toolName: string): ToolJSON | undefined;
6
+ export declare function setMcpToolMap<S extends ProjectSchemaJSON>(projectSchema: S, tools: ToolMap): S;
7
+ export declare function setMcpTool<S extends ProjectSchemaJSON>(projectSchema: S, tool: ToolJSON): S;
@@ -0,0 +1,21 @@
1
+ import set from 'lodash/fp/set.js';
2
+ const TOOL_SCHEMA_PATH = ['ai-experimental', 'mcp', 'tools'];
3
+ export function getMcpToolMap(projectSchema) {
4
+ return projectSchema['ai-experimental']?.mcp?.tools;
5
+ }
6
+ export function getMcpTools(projectSchema) {
7
+ const toolMap = getMcpToolMap(projectSchema);
8
+ return toolMap && Object.values(toolMap);
9
+ }
10
+ export function getMcpToolNames(projectSchema) {
11
+ return Object.keys(getMcpToolMap(projectSchema) ?? {});
12
+ }
13
+ export function getMcpTool(projectSchema, toolName) {
14
+ return getMcpToolMap(projectSchema)?.[toolName];
15
+ }
16
+ export function setMcpToolMap(projectSchema, tools) {
17
+ return set(TOOL_SCHEMA_PATH, tools, projectSchema);
18
+ }
19
+ export function setMcpTool(projectSchema, tool) {
20
+ return set([...TOOL_SCHEMA_PATH, tool.name], tool, projectSchema);
21
+ }
@@ -14,7 +14,7 @@ const schemaUpdateMergedKeys = [
14
14
  'services',
15
15
  'ai-experimental.agents',
16
16
  'ai-experimental.guards',
17
- 'ai-experimental.tools'
17
+ 'ai-experimental.mcp.tools'
18
18
  ];
19
19
  function shallowMerge(original, update) {
20
20
  const result = { ...original };
@@ -16,6 +16,7 @@ import coerce from 'semver/functions/coerce.js';
16
16
  import gte from 'semver/functions/gte.js';
17
17
  import lt from 'semver/functions/lt.js';
18
18
  import neq from 'semver/functions/neq.js';
19
+ import { isGuardEnabled } from "../agents.js";
19
20
  import { builtInShapes } from "../builtin-schema.js";
20
21
  import { isEnumLikeSchema } from "../enum.js";
21
22
  import { isLatestProjectSchemaJSON } from "../project-schema/index.js";
@@ -77,7 +78,7 @@ function checkToolNames(tools) {
77
78
  return Object.entries(tools)
78
79
  .filter(([name, tool]) => name !== tool.name)
79
80
  .map(([name, tool]) => ({
80
- path: ['ai-experimental', 'tools', name, 'name'],
81
+ path: ['ai-experimental', 'mcp', 'tools', name, 'name'],
81
82
  type: 'conflict',
82
83
  message: `Tool.name "${tool.name}" must match key "${name}".`
83
84
  }));
@@ -1006,12 +1007,12 @@ function validateGuards(context, schema) {
1006
1007
  if (context.ignoreEntitlements) {
1007
1008
  return errors;
1008
1009
  }
1009
- const numOfGuards = schema['ai-experimental']?.guards ? Object.keys(schema['ai-experimental']?.guards).length : 0;
1010
- const entitledToGuards = context.entitlements.guards ?? 0;
1011
- if (numOfGuards > entitledToGuards) {
1010
+ const numGuards = Object.values(schema['ai-experimental']?.guards ?? {}).filter((guard) => isGuardEnabled(guard)).length;
1011
+ const entitledGuards = context.entitlements.guards ?? 0;
1012
+ if (numGuards > entitledGuards) {
1012
1013
  errors.push({
1013
1014
  type: 'entitlement',
1014
- message: `Number of guards exceeds your entitled limit of ${entitledToGuards}`,
1015
+ message: `Number of enabled guards exceeds your entitled limit of ${entitledGuards}`,
1015
1016
  path: ['ai-experimental', 'guards']
1016
1017
  });
1017
1018
  }
@@ -1045,8 +1046,9 @@ function validateSyntax(context, schema) {
1045
1046
  .concat(validateInterfaceImplementations(schema))
1046
1047
  .concat(validateAgents(schema))
1047
1048
  .concat(validateGuards(context, schema));
1048
- if (schema['ai-experimental']?.tools) {
1049
- errors = errors.concat(checkToolNames(schema['ai-experimental']?.tools ?? {}));
1049
+ const mcpTools = schema['ai-experimental']?.mcp?.tools;
1050
+ if (mcpTools) {
1051
+ errors = errors.concat(checkToolNames(mcpTools ?? {}));
1050
1052
  }
1051
1053
  return formatValidationResult(context, errors, schema);
1052
1054
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeshape/schema",
3
- "version": "11.92.0",
3
+ "version": "11.94.3",
4
4
  "description": "TakeShape Schema",
5
5
  "homepage": "https://www.takeshape.io",
6
6
  "repository": {
@@ -58,9 +58,9 @@
58
58
  "p-reduce": "^2.1.0",
59
59
  "semver": "^7.3.2",
60
60
  "tiny-invariant": "^1.2.0",
61
- "@takeshape/errors": "11.92.0",
62
- "@takeshape/util": "11.92.0",
63
- "@takeshape/json-schema": "11.92.0"
61
+ "@takeshape/json-schema": "11.94.3",
62
+ "@takeshape/util": "11.94.3",
63
+ "@takeshape/errors": "11.94.3"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@takeshape/json-schema-to-typescript": "^11.0.0",
@@ -77,7 +77,7 @@
77
77
  "json-schema-to-ts": "^3.1.1",
78
78
  "meow": "^9.0.0",
79
79
  "shortid": "^2.2.15",
80
- "@takeshape/infra": "11.92.0"
80
+ "@takeshape/infra": "11.94.3"
81
81
  },
82
82
  "engines": {
83
83
  "node": ">=20"