add a custom tool without name #4546

Closed
opened 2026-02-21 18:06:59 -05:00 by yindo · 1 comment
Owner

Originally created by @hjlarry on GitHub (Jul 10, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.13

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

  1. create a custom tool
  2. just input the schema

image

the name here is actually the tool provider's name, it is an unique value in the backend. Here empty value not only leave a blank space on the tool's list, may also raise other problem.

✔️ Expected Behavior

  1. validate the empty value of name and schema field, when create or edit a custom tool
  2. clearly mark it as a required field

Actual Behavior

No response

Originally created by @hjlarry on GitHub (Jul 10, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.13 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce 1. create a custom tool 2. just input the schema ![image](https://github.com/langgenius/dify/assets/25834719/fe05755a-e0d1-437e-8225-6b936bbd6a06) the name here is actually the tool provider's name, it is an unique value in the backend. Here empty value not only leave a blank space on the tool's list, may also raise other problem. ### ✔️ Expected Behavior 1. validate the empty value of `name` and `schema` field, when create or edit a custom tool 2. clearly mark it as a required field ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:06:59 -05:00
yindo closed this issue 2026-02-21 18:06:59 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 10, 2024):

To ensure that the name and schema fields are validated and marked as required when creating or editing a custom tool in Dify version 0.6.13, you need to configure these fields in the tool's YAML configuration file and also ensure that the front-end interface reflects these requirements.

Here is an example of how to configure the name and schema fields in the YAML file:

identity: # Basic information of the tool
  name: google_search # Tool name, unique, no duplication with other tools
  author: Dify # Author
  label: # Label for frontend display
    en_US: GoogleSearch # English label
    zh_Hans: 谷歌搜索 # Chinese label
description: # Description for frontend display
  human: # Introduction for frontend display, supports multiple languages
    en_US: A tool for performing a Google SERP search and extracting snippets and webpages.Input should be a search query.
    zh_Hans: 一个用于执行 Google SERP 搜索并提取片段和网页的工具。输入应该是一个搜索查询。
  llm: A tool for performing a Google SERP search and extracting snippets and webpages.Input should be a search query. # Introduction passed to LLM, in order to make LLM better understand this tool, we suggest to write as detailed information about this tool as possible here, so that LLM can understand and use this tool
parameters: # Parameter list
  - name: query # Parameter name
    type: string # Parameter type
    required: true # Required or not
    label: # Parameter label
      en_US: Query string # English label
      zh_Hans: 查询语句 # Chinese label
    human_description: # Introduction for frontend display, supports multiple languages
      en_US: used for searching
      zh_Hans: 用于搜索网页内容
    llm_description: key words for searching # Introduction passed to LLM, similarly, in order to make LLM better understand this parameter, we suggest to write as detailed information about this parameter as possible here, so that LLM can understand this parameter
    form: llm # Form type, llm means this parameter needs to be inferred by Agent, the frontend will not display this parameter
  - name: result_type
    type: select # Parameter type
    required: true
    options: # Drop-down box options
      - value: text
        label:
          en_US: text
          zh_Hans: 文本
      - value: link
        label:
          en_US: link
          zh_Hans: 链接
    default: link
    label:
      en_US: Result type
      zh_Hans: 结果类型
    human_description:
      en_US: used for selecting the result type, text or link
      zh_Hans: 用于选择结果类型,使用文本还是链接进行展示
    form: form # Form type, form means this parameter needs to be filled in by the user on the frontend before the conversation starts

Additionally, ensure that the front-end interface in web/i18n/en-US/tools.ts reflects these requirements:

const translation = {
  createTool: {
    title: 'Create Custom Tool',
    editAction: 'Configure',
    editTitle: 'Edit Custom Tool',
    name: 'Name',
    toolNamePlaceHolder: 'Enter the tool name',
    nameForToolCall: 'Tool call name',
    nameForToolCallPlaceHolder: 'Used for machine recognition, such as getCurrentWeather, list_pets',
    nameForToolCallTip: 'Only supports numbers, letters, and underscores.',
    description: 'Description',
    descriptionPlaceholder: 'Brief description of the tool\'s purpose, e.g., get the temperature for a specific location.',
    schema: 'Schema',
    schemaPlaceHolder: 'Enter your OpenAPI schema here',
    viewSchemaSpec: 'View the OpenAPI-Swagger Specification',
    importFromUrl: 'Import from URL',
    importFromUrlPlaceHolder: 'https://...',
    urlError: 'Please enter a valid URL',
    examples: 'Examples',
    exampleOptions: {
      json: 'Weather(JSON)',
      yaml: 'Pet Store(YAML)',
      blankTemplate: 'Blank Template',
    },
    availableTools: {
      title: 'Available Tools',
      name: 'Name',
      description: 'Description',
      method: 'Method',
      path: 'Path',
      action: 'Actions',
      test: 'Test',
    },
    authMethod: {
      title: 'Authorization method',
      type: 'Authorization type',
      keyTooltip: 'Http Header Key, You can leave it with "Authorization" if you have no idea what it is or set it to a custom value',
      types: {
        none: 'None',
        api_key: 'API Key',
        apiKeyPlaceholder: 'HTTP header name for API Key',
        apiValuePlaceholder: 'Enter API Key',
      },
      key: 'Key',
      value: 'Value',
    },
    authHeaderPrefix: {
      title: 'Auth Type',
      types: {
        basic: 'Basic',
        bearer: 'Bearer',
        custom: 'Custom',
      },
    },
    privacyPolicy: 'Privacy policy',
    privacyPolicyPlaceholder: 'Please enter privacy policy',
    toolInput: {
      title: 'Tool Input',
      name: 'Name',
      required: 'Required',
      method: 'Method',
      methodSetting: 'Setting',
      methodSettingTip: 'User fills in the tool configuration',
      methodParameter: 'Parameter',
      methodParameterTip: 'LLM fills during inference',
      label: 'Tags',
      labelPlaceholder: 'Choose tags(optional)',
      description: 'Description',
      descriptionPlaceholder: 'Description of the parameter\'s meaning',
    },
    customDisclaimer: 'Custom disclaimer',
    customDisclaimerPlaceholder: 'Please enter custom disclaimer',
    confirmTitle: 'Confirm to save ?',
    confirmTip: 'Apps using this tool will be affected',
    deleteToolConfirmTitle: 'Delete this Tool?',
    deleteToolConfirmContent: 'Deleting the Tool is irreversible. Users will no longer be able to access your Tool.',
  },
  test: {
    title: 'Test',
    parametersValue: 'Parameters & Value',
    parameters: 'Parameters',
    value: 'Value',
    testResult: 'Test Results',
    testResultPlaceholder: 'Test result will show here',
  },
  thought: {
    using: 'Using',
    used: 'Used',
    requestTitle: 'Request to',
    responseTitle: 'Response from',
  },
}

In this configuration, the name and schema fields are marked as required by setting required: true in the YAML file and ensuring the front-end interface prompts users to fill these fields. This ensures that these fields are validated and must be provided when creating or editing a custom tool [1][2][3].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jul 10, 2024): <!-- Answer --> To ensure that the `name` and `schema` fields are validated and marked as required when creating or editing a custom tool in Dify version 0.6.13, you need to configure these fields in the tool's YAML configuration file and also ensure that the front-end interface reflects these requirements. Here is an example of how to configure the `name` and `schema` fields in the YAML file: ```yaml identity: # Basic information of the tool name: google_search # Tool name, unique, no duplication with other tools author: Dify # Author label: # Label for frontend display en_US: GoogleSearch # English label zh_Hans: 谷歌搜索 # Chinese label description: # Description for frontend display human: # Introduction for frontend display, supports multiple languages en_US: A tool for performing a Google SERP search and extracting snippets and webpages.Input should be a search query. zh_Hans: 一个用于执行 Google SERP 搜索并提取片段和网页的工具。输入应该是一个搜索查询。 llm: A tool for performing a Google SERP search and extracting snippets and webpages.Input should be a search query. # Introduction passed to LLM, in order to make LLM better understand this tool, we suggest to write as detailed information about this tool as possible here, so that LLM can understand and use this tool parameters: # Parameter list - name: query # Parameter name type: string # Parameter type required: true # Required or not label: # Parameter label en_US: Query string # English label zh_Hans: 查询语句 # Chinese label human_description: # Introduction for frontend display, supports multiple languages en_US: used for searching zh_Hans: 用于搜索网页内容 llm_description: key words for searching # Introduction passed to LLM, similarly, in order to make LLM better understand this parameter, we suggest to write as detailed information about this parameter as possible here, so that LLM can understand this parameter form: llm # Form type, llm means this parameter needs to be inferred by Agent, the frontend will not display this parameter - name: result_type type: select # Parameter type required: true options: # Drop-down box options - value: text label: en_US: text zh_Hans: 文本 - value: link label: en_US: link zh_Hans: 链接 default: link label: en_US: Result type zh_Hans: 结果类型 human_description: en_US: used for selecting the result type, text or link zh_Hans: 用于选择结果类型,使用文本还是链接进行展示 form: form # Form type, form means this parameter needs to be filled in by the user on the frontend before the conversation starts ``` Additionally, ensure that the front-end interface in `web/i18n/en-US/tools.ts` reflects these requirements: ```ts const translation = { createTool: { title: 'Create Custom Tool', editAction: 'Configure', editTitle: 'Edit Custom Tool', name: 'Name', toolNamePlaceHolder: 'Enter the tool name', nameForToolCall: 'Tool call name', nameForToolCallPlaceHolder: 'Used for machine recognition, such as getCurrentWeather, list_pets', nameForToolCallTip: 'Only supports numbers, letters, and underscores.', description: 'Description', descriptionPlaceholder: 'Brief description of the tool\'s purpose, e.g., get the temperature for a specific location.', schema: 'Schema', schemaPlaceHolder: 'Enter your OpenAPI schema here', viewSchemaSpec: 'View the OpenAPI-Swagger Specification', importFromUrl: 'Import from URL', importFromUrlPlaceHolder: 'https://...', urlError: 'Please enter a valid URL', examples: 'Examples', exampleOptions: { json: 'Weather(JSON)', yaml: 'Pet Store(YAML)', blankTemplate: 'Blank Template', }, availableTools: { title: 'Available Tools', name: 'Name', description: 'Description', method: 'Method', path: 'Path', action: 'Actions', test: 'Test', }, authMethod: { title: 'Authorization method', type: 'Authorization type', keyTooltip: 'Http Header Key, You can leave it with "Authorization" if you have no idea what it is or set it to a custom value', types: { none: 'None', api_key: 'API Key', apiKeyPlaceholder: 'HTTP header name for API Key', apiValuePlaceholder: 'Enter API Key', }, key: 'Key', value: 'Value', }, authHeaderPrefix: { title: 'Auth Type', types: { basic: 'Basic', bearer: 'Bearer', custom: 'Custom', }, }, privacyPolicy: 'Privacy policy', privacyPolicyPlaceholder: 'Please enter privacy policy', toolInput: { title: 'Tool Input', name: 'Name', required: 'Required', method: 'Method', methodSetting: 'Setting', methodSettingTip: 'User fills in the tool configuration', methodParameter: 'Parameter', methodParameterTip: 'LLM fills during inference', label: 'Tags', labelPlaceholder: 'Choose tags(optional)', description: 'Description', descriptionPlaceholder: 'Description of the parameter\'s meaning', }, customDisclaimer: 'Custom disclaimer', customDisclaimerPlaceholder: 'Please enter custom disclaimer', confirmTitle: 'Confirm to save ?', confirmTip: 'Apps using this tool will be affected', deleteToolConfirmTitle: 'Delete this Tool?', deleteToolConfirmContent: 'Deleting the Tool is irreversible. Users will no longer be able to access your Tool.', }, test: { title: 'Test', parametersValue: 'Parameters & Value', parameters: 'Parameters', value: 'Value', testResult: 'Test Results', testResultPlaceholder: 'Test result will show here', }, thought: { using: 'Using', used: 'Used', requestTitle: 'Request to', responseTitle: 'Response from', }, } ``` In this configuration, the `name` and `schema` fields are marked as required by setting `required: true` in the YAML file and ensuring the front-end interface prompts users to fill these fields. This ensures that these fields are validated and must be provided when creating or editing a custom tool <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/i18n/zh-Hans/tools.ts)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/zh_CN/guides/tools/quick-tool-integration.md)</sup><sup>[[3]](https://github.com/langgenius/dify/blob/main/web/i18n/en-US/tools.ts)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4546