Skip to content

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

@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

    enhancementRequest for a new feature that's not currently supported

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions