Skip to content

Fix: update the "RegisterTool" method in server.go #115

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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FuradWho
Copy link

When we were creating a new server registration tool, we used the "RegisterTool" method, but the "handler any" in it and the "createJsonSchemaFromHandler" method left us quite confused. We think the inputSchema can be passed in directly without the need for conversion.

When we were creating a new server registration tool, we used the "RegisterTool" method, but the "handler any" in it and the "createJsonSchemaFromHandler" method left us quite confused. We think the inputSchema can be passed in directly without the need for conversion.
@FuradWho FuradWho changed the title Update server.go Fix server.go May 17, 2025
@FuradWho
Copy link
Author

FuradWho commented May 17, 2025

func (s *Server) RegisterToolWithInputSchema(name string, description string, handler any, inputSchema *jsonschema.Schema) error {
	err := validateToolHandler(handler)
	if err != nil {
		return err
	}
	//inputSchema := createJsonSchemaFromHandler(handler)

	s.tools.Store(name, &tool{
		Name:            name,
		Description:     description,
		Handler:         createWrappedToolHandler(handler),
		ToolInputSchema: inputSchema,
	})

	return s.sendToolListChangedNotification()
}

@FuradWho FuradWho changed the title Fix server.go Fix: update the "RegisterTool" method in server.go May 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant