Skip to main content
Glama
search.tool.ts621 B
import { z } from "zod"; import { searchArticles } from "./data.js"; export function createSearchTool(server: any) { server.tool( "search", "Search articles. Pass in a query string.", { query: z.string().describe("The search query for articles."), }, async ({ query }: { query: string }) => { const searchResults = await searchArticles(query, 10); return { structuredContent: { results: searchResults.results }, content: [ { type: "text" as const, text: JSON.stringify(searchResults), }, ], }; } ); }

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/mcpauth/mcpauth'

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