Skip to main content
Glama

Manifold Markets MCP Server

add_answer

Add a new answer option to a multiple choice market on Manifold Markets by specifying the market ID and the answer text.

Instructions

Add a new answer to a multiple choice market

Input Schema

NameRequiredDescriptionDefault
contractIdYesMarket ID
textYesAnswer text

Input Schema (JSON Schema)

{ "properties": { "contractId": { "description": "Market ID", "type": "string" }, "text": { "description": "Answer text", "type": "string" } }, "required": [ "contractId", "text" ], "type": "object" }

Implementation Reference

  • The handler for the 'add_answer' tool. Parses arguments using AddAnswerSchema, requires MANIFOLD_API_KEY, sends POST request to Manifold Markets API to add an answer to the specified market, handles errors, and returns a success message with the 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 validation schema for 'add_answer' tool inputs: contractId (string) and text (non-empty string).
    const AddAnswerSchema = z.object({ contractId: z.string(), text: z.string().min(1), });
  • src/index.ts:337-348 (registration)
    Tool registration in the MCP server's listTools handler, defining name, description, and JSON schema for inputs.
    { 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'] } },

Other Tools

Related Tools

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