@redocly/config 0.54.0 → 0.56.0

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.
@@ -6,6 +6,7 @@ import type { RedocConfigTypes } from './redoc-types.js';
6
6
  import type { GraphQLConfigTypes } from './graphql-types.js';
7
7
  import type { productConfigSchema, productGoogleAnalyticsConfigSchema, markdownConfigSchema, amplitudeAnalyticsConfigSchema, rudderstackAnalyticsConfigSchema, segmentAnalyticsConfigSchema, gtmAnalyticsConfigSchema, googleAnalyticsConfigSchema, scorecardConfigSchema, catalogFilterSchema, catalogSchema, searchFacetsConfigSchema } from '../ex-theme-config-schemas.js';
8
8
  import type { scorecardsConfigSchema } from '../scorecards-config-schema.js';
9
+ import type { recheckConfigSchema } from '../recheck-config-schema.js';
9
10
  import type { reuniteConfigSchema } from '../reunite-config-schema.js';
10
11
  import type { optionalEmailSettings, reasonsSettings } from '../feedback-config-schema.js';
11
12
  import type { AsyncApiConfigTypes } from './asyncapi-types.js';
@@ -31,6 +32,7 @@ export type CatalogFilterConfig = FromSchema<typeof catalogFilterSchema>;
31
32
  export type ReuniteConfig = FromSchema<typeof reuniteConfigSchema>;
32
33
  export type ScorecardConfig = FromSchema<typeof scorecardConfigSchema>;
33
34
  export type ScorecardsConfig = FromSchema<typeof scorecardsConfigSchema>;
35
+ export type RecheckConfig = FromSchema<typeof recheckConfigSchema>;
34
36
  export type SearchFacetsConfig = FromSchema<typeof searchFacetsConfigSchema>;
35
37
  export type SkillsConfig = FromSchema<typeof skillsConfigSchema>;
36
38
  type RootRedoclyConfig = FromSchema<typeof rootRedoclyConfigSchema>;
@@ -1,4 +1,5 @@
1
1
  export * from './api-functions-types.js';
2
+ export * from './mcp-tools-types.js';
2
3
  export * from './config-types.js';
3
4
  export * from './portal-shared-types.js';
4
5
  export * from './catalog-entity-types.js';
@@ -0,0 +1,81 @@
1
+ import type { JSONSchema } from 'json-schema-to-ts';
2
+ import type { ApiFunctionsContext, ApiFunctionsContextMethods } from './api-functions-types.js';
3
+ /** A JSON Schema (draft-07) object, as accepted by MCP tool definitions. */
4
+ export type McpToolJsonSchema = Exclude<JSONSchema, boolean>;
5
+ export type McpToolJsonValue = string | number | boolean | null | McpToolJsonValue[] | {
6
+ [key: string]: McpToolJsonValue;
7
+ };
8
+ /** Structurally compatible with the MCP protocol `CallToolResult`. */
9
+ export type McpToolResult = {
10
+ content: Array<{
11
+ type: 'text' | 'image' | 'audio' | 'resource' | 'resource_link';
12
+ text?: string;
13
+ [key: string]: unknown;
14
+ }>;
15
+ structuredContent?: Record<string, unknown>;
16
+ isError?: boolean;
17
+ _meta?: Record<string, unknown>;
18
+ };
19
+ /** Behavior hints for MCP clients, as defined by the MCP specification. */
20
+ export type McpToolAnnotations = {
21
+ title?: string;
22
+ readOnlyHint?: boolean;
23
+ destructiveHint?: boolean;
24
+ idempotentHint?: boolean;
25
+ openWorldHint?: boolean;
26
+ };
27
+ export type McpToolFileSystem = {
28
+ /**
29
+ * Reads a text file from the built project output (which includes a Markdown
30
+ * twin of every page). A path that escapes the output directory is rejected.
31
+ */
32
+ readFile: (path: string) => Promise<string>;
33
+ };
34
+ /** Context passed to a custom MCP tool's `execute` and `isAvailable` functions. */
35
+ export type McpToolContext = Omit<ApiFunctionsContext, 'telemetry' | 'getKv' | keyof ApiFunctionsContextMethods> & {
36
+ /** Scoped file access to the built project output. */
37
+ fs: McpToolFileSystem;
38
+ /** Product names configured in the project. */
39
+ products?: string[];
40
+ /** Access token of the authenticated MCP connection. */
41
+ accessToken?: string;
42
+ /** Free-form caller metadata, parsed from the `X-Redocly-AI-Metadata` request header. */
43
+ metadata?: Record<string, unknown>;
44
+ };
45
+ /** MCP protocol metadata passed to a custom MCP tool's `execute` function. */
46
+ export type McpToolCallExtra = {
47
+ sessionId?: string;
48
+ requestId: string | number;
49
+ authInfo?: {
50
+ token: string;
51
+ clientId: string;
52
+ scopes: string[];
53
+ expiresAt?: number;
54
+ [key: string]: unknown;
55
+ };
56
+ requestInfo?: {
57
+ headers: Record<string, string | string[] | undefined>;
58
+ };
59
+ _meta?: Record<string, unknown>;
60
+ };
61
+ /**
62
+ * A custom MCP tool defined by a file in an `@mcp` folder.
63
+ * The file's default export must satisfy this type; the tool name is the file name without extension.
64
+ */
65
+ export type McpToolDefinition<TArgs extends Record<string, unknown> = Record<string, unknown>> = {
66
+ /** Human-readable description shown to MCP clients and AI models. */
67
+ description: string;
68
+ /** JSON Schema for the tool's input arguments. Defaults to an empty object schema. */
69
+ inputSchema?: McpToolJsonSchema & {
70
+ type?: 'object';
71
+ };
72
+ outputSchema?: McpToolJsonSchema;
73
+ annotations?: McpToolAnnotations;
74
+ /** Controls whether the tool is advertised to the current MCP connection. */
75
+ isAvailable?: (context: McpToolContext) => boolean | Promise<boolean>;
76
+ /**
77
+ * Runs the tool. A returned string or JSON value is wrapped into an MCP
78
+ * result automatically; throw an `Error` to report a failure.
79
+ */
80
+ execute: (args: TArgs, context: McpToolContext, extra: McpToolCallExtra) => McpToolResult | McpToolJsonValue | Promise<McpToolResult | McpToolJsonValue>;
81
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/config",
3
- "version": "0.54.0",
3
+ "version": "0.56.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -21,14 +21,16 @@
21
21
  "devDependencies": {
22
22
  "@markdoc/markdoc": "0.5.2",
23
23
  "esbuild": "0.28.1",
24
- "@redocly/openapi-core": "2.47.0",
24
+ "@redocly/ajv": "8.18.0",
25
+ "@redocly/openapi-core": "2.49.1",
25
26
  "@types/node": "24.1.0",
26
27
  "@types/react": "^19.2.7",
27
- "@vitest/coverage-v8": "4.1.10",
28
+ "@vitest/coverage-v8": "4.1.11",
29
+ "ajv-formats": "^3.0.1",
28
30
  "react-router": "^8.3.0",
29
31
  "rimraf": "5.0.7",
30
32
  "typescript": "6.0.3",
31
- "vitest": "4.1.10"
33
+ "vitest": "4.1.11"
32
34
  },
33
35
  "dependencies": {
34
36
  "json-schema-to-ts": "2.7.2"