Closed
Description
When registering a tool using server.tool, like in the example below:
server.tool(
"get-neme",
{
slug: z.string().min(1).describe("The slug of the neme"),
} as ToolAnnotations,
async ({ slug }) => {
return {
content: [{ type: "text", text: `${slug}` }],
};
}
);
The returned object should conform to the RegisteredTool
type, which includes the inputSchema
. However, in practice, inputSchema
is always undefined.
This causes issues with the MCP Client, specifically the MCP Inspector, which relies on inputSchema
to display and send input arguments. Without it, tools are effectively unusable via the default MCP Client interface.
Current Workaround
The only way to make the tool usable in the MCP Client is to manually modify the server.tool call to ensure inputSchema is properly populated.
const tool = server.tool(
"get-neme",
{
slug: z.string().min(1).describe("The slug of the neme"),
} as ToolAnnotations,
async ({ slug }) => {
return {
content: [{ type: "text", text: `${slug}` }],
};
}
);
Object.assign(tool, {
inputSchema: z.object({
slug: z.string().min(1).describe("The slug of the neme"),
}),
});
Metadata
Metadata
Assignees
Labels
No labels