Skip to main content
Glama
bmorphism

Manifold Markets MCP Server

add_answer

Add a new answer option to a multiple choice prediction market on Manifold Markets, enabling users to expand market possibilities and participate in forecasting.

Instructions

Add a new answer to a multiple choice market

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contractIdYesMarket ID
textYesAnswer text

Implementation Reference

  • Handler for the 'add_answer' tool: parses arguments with AddAnswerSchema, checks for API key, sends POST request to Manifold Markets API to add a new answer to the specified market, and returns success message with new answer ID.
    case 'add_answer': {
      const params = AddAnswerSchema.parse(args);
      const apiKey = process.env.MANIFOLD_API_KEY;
      if (!apiKey) {
        throw new McpError(
          ErrorCode.InternalError,
          'MANIFOLD_API_KEY environment variable is required'
        );
      }
    
      const response = await fetch(`${API_BASE}/v0/market/${params.contractId}/answer`, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          Authorization: `Key ${apiKey}`,
        },
        body: JSON.stringify({
          text: params.text,
        }),
      });
    
      if (!response.ok) {
        throw new McpError(
          ErrorCode.InternalError,
          `Manifold API error: ${response.statusText}`
        );
      }
    
      const result = await response.json();
      return {
        content: [
          {
            type: 'text',
            text: `Answer added with ID: ${result.newAnswerId}`,
          },
        ],
      };
    }
  • Zod schema defining the input parameters for the 'add_answer' tool: contractId (market ID) and text (answer text, min length 1).
    const AddAnswerSchema = z.object({
      contractId: z.string(),
      text: z.string().min(1),
    });
  • src/index.ts:337-348 (registration)
    Registration of the 'add_answer' tool in the ListToolsRequestSchema handler, specifying name, description, and input schema matching AddAnswerSchema.
    {
      name: 'add_answer',
      description: 'Add a new answer to a multiple choice market',
      inputSchema: {
        type: 'object',
        properties: {
          contractId: { type: 'string', description: 'Market ID' },
          text: { type: 'string', description: 'Answer text' }
        },
        required: ['contractId', 'text']
      }
    },

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/bmorphism/manifold-mcp-server'

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