diff --git a/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.ts b/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.ts index 33a003f044aaa..b80c776556b86 100644 --- a/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.ts +++ b/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.ts @@ -15,7 +15,7 @@ import { ILogService } from '../../../../../platform/log/common/log.js'; import { IWorkbenchContribution } from '../../../../common/contributions.js'; import { ILanguageModelToolsService, IToolData } from '../languageModelToolsService.js'; import * as extensionsRegistry from '../../../../services/extensions/common/extensionsRegistry.js'; -import { toolsParametersSchemaSchema } from './languageModelToolsParametersSchema.js'; +import { toolsParametersSchemaSchemaId } from './languageModelToolsParametersSchema.js'; export interface IRawToolContribution { name: string; @@ -84,8 +84,8 @@ const languageModelToolsExtensionPoint = extensionsRegistry.ExtensionsRegistry.r type: 'string' }, parametersSchema: { - ...toolsParametersSchemaSchema, description: localize('parametersSchema', "A JSON schema for the parameters this tool accepts. The parameters must be an object at the top level. A particular language model may not support all JSON schema features. See the documentation for the language model family you are using for more information."), + $ref: toolsParametersSchemaSchemaId, }, canBeReferencedInPrompt: { markdownDescription: localize('canBeReferencedInPrompt', "If true, this tool shows up as an attachment that the user can add manually to their request. Chat participants will receive the tool in {0}.", '`ChatRequest#toolReferences`'), diff --git a/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.ts b/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.ts index 336aa24244d21..72a12bced9927 100644 --- a/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.ts +++ b/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.ts @@ -4,13 +4,16 @@ *--------------------------------------------------------------------------------------------*/ import { IJSONSchema } from '../../../../../base/common/jsonSchema.js'; +import { Extensions as JSONExtensions, IJSONContributionRegistry } from '../../../../../platform/jsonschemas/common/jsonContributionRegistry.js'; +import { Registry } from '../../../../../platform/registry/common/platform.js'; /** * A schema for parametersSchema * This is a subset of https://json-schema.org/draft-07/schema to capture what is actually supported by language models for tools, mainly, that they must be an object at the top level. * Possibly it can be whittled down some more based on which attributes are supported by language models. */ -export const toolsParametersSchemaSchema: IJSONSchema = { +export const toolsParametersSchemaSchemaId = 'vscode://schemas/toolsParameters'; +const toolsParametersSchemaSchema: IJSONSchema = { definitions: { schemaArray: { type: 'array', @@ -252,3 +255,5 @@ export const toolsParametersSchemaSchema: IJSONSchema = { }, }], }; +const contributionRegistry = Registry.as(JSONExtensions.JSONContribution); +contributionRegistry.registerSchema(toolsParametersSchemaSchemaId, toolsParametersSchemaSchema);