Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Open
@kkomelin

Description

@kkomelin

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions