search_assets
Find WebSim assets by entering a search query to browse projects, discover content, and access community resources.
Instructions
Search for WebSim assets
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query | |
| limit | No | Number of results to return (default: 20) | |
| offset | No | Number of results to skip (default: 0) |
Input Schema (JSON Schema)
{
"properties": {
"limit": {
"default": 20,
"description": "Number of results to return (default: 20)",
"type": "number"
},
"offset": {
"default": 0,
"description": "Number of results to skip (default: 0)",
"type": "number"
},
"query": {
"description": "Search query",
"type": "string"
}
},
"required": [
"query"
],
"type": "object"
}
Implementation Reference
- server.js:809-822 (handler)The main execution handler for the search_assets MCP tool. Validates input parameters using Zod's SearchParamsSchema, invokes the API client's searchAssets helper, formats the response as MCP content, and includes success metadata.handler: async (args) => { const { query, limit = 20, offset = 0 } = SearchParamsSchema.parse(args); const result = await apiClient.searchAssets(query, limit, offset); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Found ${result.items?.length || 0} assets matching "${query}"` }, null, 2) }] }; }
- server.js:789-808 (schema)JSON schema defining the input parameters for the search_assets tool as required by MCP protocol (query required, limit/offset optional).inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query" }, limit: { type: "number", description: "Number of results to return (default: 20)", default: 20 }, offset: { type: "number", description: "Number of results to skip (default: 0)", default: 0 } }, required: ["query"] },
- server.js:786-823 (registration)Complete tool registration object added to the tools array, specifying name 'search_assets', description, input schema, and inline handler function.{ name: "search_assets", description: "Search for WebSim assets", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query" }, limit: { type: "number", description: "Number of results to return (default: 20)", default: 20 }, offset: { type: "number", description: "Number of results to skip (default: 0)", default: 0 } }, required: ["query"] }, handler: async (args) => { const { query, limit = 20, offset = 0 } = SearchParamsSchema.parse(args); const result = await apiClient.searchAssets(query, limit, offset); return { content: [{ type: "text", text: JSON.stringify({ success: true, data: result, message: `Found ${result.items?.length || 0} assets matching "${query}"` }, null, 2) }] }; } },
- server.js:186-193 (helper)API client helper method that constructs the search query parameters and makes an HTTP GET request to WebSim's /api/v1/search/assets endpoint.async searchAssets(query, limit = 20, offset = 0) { const params = new URLSearchParams({ q: query, limit: limit.toString(), offset: offset.toString() }); return this.makeRequest(`/api/v1/search/assets?${params}`); }
- server.js:41-45 (schema)Zod schema used for runtime input validation within the tool handler, matching the MCP inputSchema.const SearchParamsSchema = z.object({ query: z.string().describe('Search query'), limit: z.number().optional().default(20).describe('Number of results to return (default: 20)'), offset: z.number().optional().default(0).describe('Number of results to skip (default: 0)') });