search-web
Search the web and retrieve content in markdown format for AI clients, enabling web unblocking and content access.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Implementation Reference
- src/index.ts:43-59 (handler)The inline handler function for the 'search-web' tool. It fetches search results from the pure.md API endpoint using the provided query and API key, returning markdown content or an error message.server.tool("search-web", { query: z.string() }, async ({ query }) => { try { const response = await fetch(`https://pure.md/search?q=${query}`, { headers: { "x-puremd-api-token": PUREMD_API_KEY }, }); const markdown = await response.text(); return { content: [{ type: "text", text: markdown }], isError: false, }; } catch (error) { return { content: [{ type: "text", text: (error as Error).message }], isError: true, }; } });
- src/index.ts:43-43 (schema)Zod input schema for the 'search-web' tool, defining a single 'query' parameter as a string.server.tool("search-web", { query: z.string() }, async ({ query }) => {
- src/index.ts:43-59 (registration)Registration of the 'search-web' tool on the MCP server using server.tool(), including inline schema and handler.server.tool("search-web", { query: z.string() }, async ({ query }) => { try { const response = await fetch(`https://pure.md/search?q=${query}`, { headers: { "x-puremd-api-token": PUREMD_API_KEY }, }); const markdown = await response.text(); return { content: [{ type: "text", text: markdown }], isError: false, }; } catch (error) { return { content: [{ type: "text", text: (error as Error).message }], isError: true, }; } });