Skip to main content
Glama
bmorphism

Manifold Markets MCP Server

follow_market

Manage market subscriptions on Manifold Markets by following or unfollowing specific prediction markets to track updates and activity.

Instructions

Follow or unfollow a market

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contractIdYesMarket ID
followYesTrue to follow, false to unfollow

Implementation Reference

  • Handler for follow_market tool: Parses input with FollowMarketSchema, checks for MANIFOLD_API_KEY, makes POST request to /v0/follow-contract with contractId and follow boolean, returns success message.
    case 'follow_market': {
      const params = FollowMarketSchema.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/follow-contract`, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          Authorization: `Key ${apiKey}`,
        },
        body: JSON.stringify({
          contractId: params.contractId,
          follow: params.follow,
        }),
      });
    
      if (!response.ok) {
        throw new McpError(
          ErrorCode.InternalError,
          `Manifold API error: ${response.statusText}`
        );
      }
    
      return {
        content: [
          {
            type: 'text',
            text: params.follow ? 'Now following market' : 'Unfollowed market',
          },
        ],
      };
    }
  • Zod schema defining input for follow_market: contractId (string), follow (boolean).
    const FollowMarketSchema = z.object({
      contractId: z.string(),
      follow: z.boolean(),
    });
  • src/index.ts:349-360 (registration)
    Tool registration in listTools response, including name, description, and inputSchema matching the Zod schema.
    {
      name: 'follow_market',
      description: 'Follow or unfollow a market',
      inputSchema: {
        type: 'object',
        properties: {
          contractId: { type: 'string', description: 'Market ID' },
          follow: { type: 'boolean', description: 'True to follow, false to unfollow' }
        },
        required: ['contractId', 'follow']
      }
    },

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