Skip to content

Unable to test root endpoint without an operationId in a custom tool #19887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
5 tasks done
haocheng6 opened this issue May 19, 2025 · 1 comment · May be fixed by #19888
Open
5 tasks done

Unable to test root endpoint without an operationId in a custom tool #19887

haocheng6 opened this issue May 19, 2025 · 1 comment · May be fixed by #19888
Labels
🔨 feat:tools Tools for agent, function call related stuff.

Comments

@haocheng6
Copy link
Contributor

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).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.4.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Run an API server that responds with an arbitrary response to requests to the root URL.
  2. Create a custom tool in Dify with the following Swagger schema:
openapi: 3.0.0
info:
  title: Simple API
  version: 1.0.0
servers: 
  - url: http://host.docker.internal:3001
paths:
  /:
    get:
      summary: Root endpoint
      description: Returns a simple message from the root endpoint.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Hello, world!
  1. Test the root endpoint in the "Edit Custom Tool" drawer.
    Image
  2. After clicking the test button, an error message will appear on the screen.

✔️ Expected Behavior

The root endpoint can be tested without any issue.

❌ Actual Behavior

Image

@dosubot dosubot bot added the 🔨 feat:tools Tools for agent, function call related stuff. label May 19, 2025
Copy link

dosubot bot commented May 19, 2025

The issue you're encountering with testing the root endpoint in a custom tool without an operationId is likely related to the tool name validation in Dify. The error message "invalid tool name" suggests that the tool name might not be adhering to Dify's naming conventions. Dify requires tool names to only contain numbers, letters, and underscores [1].

To resolve this issue, ensure that the tool name in your Swagger schema or in the Dify interface follows these guidelines. If the operationId is missing, Dify automatically generates a tool_name, which must also comply with these naming rules. You might want to explicitly set an operationId in your Swagger schema to control the tool name and ensure it meets the requirements.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 feat:tools Tools for agent, function call related stuff.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant