Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
limitNoNumber of results to return (default: 20)
offsetNoNumber of results to skip (default: 0)

Implementation Reference

  • 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)
        }]
      };
    }
  • 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)
          }]
        };
      }
    },
  • 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}`);
    }
  • 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)')
    });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gigachadtrey/websimm'

If you have feedback or need assistance with the MCP directory API, please join our Discord server