Skip to main content
Glama

Backlog MCP Server

wrapWithToolResult.test.ts1.55 kB
import { wrapWithToolResult } from './wrapWithToolResult.js'; import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js'; import { describe, it, expect } from '@jest/globals'; describe('wrapWithToolResult', () => { const dummyExtra = {} as RequestHandlerExtra; it('returns error result when SafeResult is error', async () => { const fn = async () => ({ kind: 'error', message: 'Something went wrong' }) as const; const wrapped = wrapWithToolResult(fn); const result = await wrapped({}, dummyExtra); expect(result).toEqual({ isError: true, content: [ { type: 'text', text: 'Something went wrong', }, ], }); }); it('returns plain text when result data is string', async () => { const fn = async () => ({ kind: 'ok', data: 'Hello, world' }) as const; const wrapped = wrapWithToolResult(fn); const result = await wrapped({}, dummyExtra); expect(result).toEqual({ content: [ { type: 'text', text: 'Hello, world', }, ], }); }); it('returns JSON text when result data is object', async () => { const fn = async () => ({ kind: 'ok', data: { id: 1, name: 'Test' } }) as const; const wrapped = wrapWithToolResult(fn); const result = await wrapped({}, dummyExtra); expect(result).toEqual({ content: [ { type: 'text', text: JSON.stringify({ id: 1, name: 'Test' }, null, 2), }, ], }); }); });

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/nulab/backlog-mcp-server'

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