Loading...
Loading...
Add, edit, debug, and test WebMCP tools built with webmcp-kit. Use when users ask to create or modify defineTool-based tools, fix missing tools, resolve schema/execution errors, or validate tools in dev panel/native mode.
npx skill4agent add victorhuangwq/webmcp-kit add-webmcp-toolsdefineTool(...)package.jsonwebmcp-kitzodnpm install webmcp-kit zodrg -n "defineTool\(|\.register\(" srcrg -n "enableDevMode\(" srcsrc/mcp-tools.tssrc/lib/mcp-tools.tssrc/mcp/*.ts.register()enableDevMode()inputSchema.describe().default()executetextContentjsonContenterrorContent.register()import { defineTool, jsonContent } from 'webmcp-kit';
import { z } from 'zod';
export const searchProducts = defineTool({
name: 'searchProducts',
description: 'Search products by query',
inputSchema: z.object({
query: z.string().describe('Search text entered by user'),
limit: z.number().min(1).max(50).default(10).describe('Maximum results'),
}),
execute: async ({ query, limit }) => {
const results = await db.products.search(query, limit);
return jsonContent(results);
},
});
searchProducts.register();descriptioninputSchemaexecuteannotations.register().min().max().regex()z.enum(...)jsonContent.optional().default().register()enableDevMode()[webmcp-kit]inputSchemaexecutenavigator.modelContext[webmcp-kit] Using mock modelContext for tool "toolName". Native WebMCP not available.enableDevMode()const result = await searchProducts.execute({ query: 'pizza', limit: 5 });console.log(searchProducts.inputSchema); // JSON Schema
console.log(searchProducts.schema); // original Zod schemaannotations: { destructiveHint: true }confirmationHint: trueexecuteconst deleteItem = defineTool({
// ...
annotations: { destructiveHint: true },
execute: async (input, agent) => {
const { confirmed } = await agent.requestUserInteraction({
prompt: 'Are you sure?',
type: 'confirmation',
});
if (!confirmed) return 'Cancelled';
// perform mutation
},
});description.describe(...).optional().default(...).register()enableDevMode()