Skip to main content
Glama
tool.test.hbs903 B
import { {{pascalCase name}}Tool } from '../{{kebabCase name}}-tool/{{pascalCase name}}Tool.js'; import { setupFetch, assertHeadersSent } from '../../utils/requestUtils.test-helpers.js'; describe('{{pascalCase name}}Tool', () => { afterEach(() => { jest.restoreAllMocks(); }); it('sends custom header', async () => { const mockFetch = setupFetch(); await new {{pascalCase name}}Tool().run({...}); assertHeadersSent(mockFetch); }); it('handles fetch errors gracefully', async () => { const mockFetch = setupFetch({ ok: false, status: 404, statusText: 'Not Found' }); const result = await new {{pascalCase name}}Tool().run({...}); expect(result.isError).toBe(true); expect(result.content[0]).toMatchObject({ type: 'text', text: 'Request failed with status 404: Not Found' }); assertHeadersSent(mockFetch); }); });

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/Waldzell-Agentics/mcp-server'

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