Skip to main content
Glama

Manifold Markets MCP Server

close_market

Shut down a market for trading by specifying the market ID and optional close time, ensuring no further bets are placed. Part of the Manifold Markets MCP Server.

Instructions

Close a market for trading

Input Schema

NameRequiredDescriptionDefault
closeTimeNoOptional. Unix timestamp in milliseconds when market will close
contractIdYesMarket ID

Input Schema (JSON Schema)

{ "properties": { "closeTime": { "description": "Optional. Unix timestamp in milliseconds when market will close", "type": "number" }, "contractId": { "description": "Market ID", "type": "string" } }, "required": [ "contractId" ], "type": "object" }

Implementation Reference

  • Handler for close_market tool. Parses input parameters using CloseMarketSchema, requires MANIFOLD_API_KEY, sends POST request to Manifold Markets API to close the specified market (optionally at a future closeTime), handles errors, and returns a success message.
    case 'close_market': { const params = CloseMarketSchema.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}/close`, { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: `Key ${apiKey}`, }, body: JSON.stringify({ closeTime: params.closeTime, }), }); if (!response.ok) { throw new McpError( ErrorCode.InternalError, `Manifold API error: ${response.statusText}` ); } return { content: [ { type: 'text', text: 'Market closed successfully', }, ], }; }
  • Zod schema defining input for close_market: required contractId (string), optional closeTime (non-negative integer Unix timestamp in ms).
    const CloseMarketSchema = z.object({ contractId: z.string(), closeTime: z.number().int().nonnegative().optional(), });
  • src/index.ts:325-336 (registration)
    Tool registration in ListTools response: defines name 'close_market', description, and inputSchema matching the Zod schema.
    { name: 'close_market', description: 'Close a market for trading', inputSchema: { type: 'object', properties: { contractId: { type: 'string', description: 'Market ID' }, closeTime: { type: 'number', description: 'Optional. Unix timestamp in milliseconds when market will close' } }, required: ['contractId'] } },

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