Skip to main content
Glama
bmorphism

Manifold Markets MCP Server

close_market

Closes a prediction market to new trades, optionally at a specified time.

Instructions

Close a market for trading

Input Schema

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

Implementation Reference

  • Zod schema for close_market tool validation. Expects contractId (string) and optional closeTime (nonnegative integer).
    const CloseMarketSchema = z.object({
      contractId: z.string(),
      closeTime: z.number().int().nonnegative().optional(),
    });
  • Handler for the 'close_market' tool. Parses arguments with Zod schema, checks for MANIFOLD_API_KEY env var, sends POST request to Manifold API /v0/market/{contractId}/close endpoint, and returns success text on completion.
    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',
          },
        ],
      };
    }
  • src/index.ts:326-336 (registration)
    Registration of the close_market tool with name, description, and inputSchema for the MCP server.
      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']
      }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It only says 'close a market' without disclosing side effects, reversibility, or required permissions. The behavioral impact is unclear.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence and concise, but it omits important details that would make it more useful. Not overly verbose, but under-specified.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description should explain return value, side effects, and restrictions. It does not, leaving the agent underinformed for tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the description adds no extra meaning beyond the schema. Baseline 3 is appropriate as the schema already describes the parameters adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Close a market for trading' clearly states the action and resource, but does not distinguish it from sibling tools like 'unresolve_market' which may have a similar effect.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus siblings such as 'unresolve_market', 'create_market', or 'cancel_bet'. Prerequisites or context are missing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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