Skip to content

Allow passing a Tool object to the server.tool() method #369

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
kkomelin opened this issue Apr 19, 2025 · 1 comment
Open

Allow passing a Tool object to the server.tool() method #369

kkomelin opened this issue Apr 19, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@kkomelin
Copy link

Is your feature request related to a problem? Please describe.

The problem with the current server.tool() implementations is that a tool is not treated as a monolith entity and rather treated as a set of separate variables, such as name, description, callback and others.

Example:

tool(name, description, inputParams, callback)

Describe the solution you'd like

I'd like to propose adding two things:

  1. Add a Tool type, similar to RegisteredTool, like this:
export type Tool = {
  name: string;
  description?: string;
  inputSchema?: AnyZodObject;
  callback: ToolCallback<undefined | ZodRawShape>;
};
  1. Add one more server.tools() implementation which accepts an object of the newly created Tool type:
tool(name: string, tool: Tool)
# or even better:
tool(tool: Tool)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant