Skip to main content
Glama
aws-powertools

Powertools MCP Search Server

tool.ts1.19 kB
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'; import { logger } from '../../logger.ts'; import { buildResponse } from '../shared/buildResponse.ts'; import { fetchWithCache } from '../shared/fetchWithCache.ts'; import { name as toolName } from './constants.ts'; import type { ToolProps } from './types.ts'; /** * Fetch a documentation page from remote or local cache. * * @see - {@link fetchWithCache | `fetchWithCache`} for the implementation details on caching and fetching. * * @param props - options for fetching a documentation page * @param props.url - the URL of the documentation page to fetch */ const tool = async (props: ToolProps): Promise<CallToolResult> => { const { url } = props; logger.appendKeys({ tool: toolName }); logger.appendKeys({ url: url.toString() }); try { return buildResponse({ content: await fetchWithCache({ url, contentType: 'text/markdown' }), }); } catch (error) { return buildResponse({ content: `${(error as Error).message}`, isError: true, }); /* v8 ignore start */ } finally { /* v8 ignore stop */ logger.removeKeys(['tool', 'url']); } }; export { tool };

Implementation Reference

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/aws-powertools/powertools-mcp'

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