Skip to main content
Glama
bmorphism

Manifold Markets MCP Server

sell_shares

Sell YES or NO shares in Manifold Markets prediction markets to manage your positions and realize profits or limit losses.

Instructions

Sell shares in a market

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
marketIdYesMarket ID
outcomeNoWhich type of shares to sell (defaults to what you have)
sharesNoHow many shares to sell (defaults to all)

Implementation Reference

  • The handler function for the 'sell_shares' tool. It validates input using SellSharesSchema, checks for API key, makes a POST request to Manifold Markets API endpoint /v0/market/{marketId}/sell to sell shares, handles errors, and returns the result as text content.
    case 'sell_shares': {
      const params = SellSharesSchema.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.marketId}/sell`, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          Authorization: `Key ${apiKey}`,
        },
        body: JSON.stringify({
          outcome: params.outcome,
          shares: params.shares,
        }),
      });
    
      if (!response.ok) {
        throw new McpError(
          ErrorCode.InternalError,
          `Manifold API error: ${response.statusText}`
        );
      }
    
      const result = await response.json();
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Zod schema for validating input parameters to the sell_shares tool: marketId (required string), outcome (optional YES/NO), shares (optional number).
    const SellSharesSchema = z.object({
      marketId: z.string(),
      outcome: z.enum(['YES', 'NO']).optional(),
      shares: z.number().optional(),
    });
  • src/index.ts:277-289 (registration)
    Tool registration in the ListTools handler, defining the name, description, and JSON inputSchema for sell_shares.
    {
      name: 'sell_shares',
      description: 'Sell shares in a market',
      inputSchema: {
        type: 'object',
        properties: {
          marketId: { type: 'string', description: 'Market ID' },
          outcome: { type: 'string', enum: ['YES', 'NO'], description: 'Which type of shares to sell (defaults to what you have)' },
          shares: { type: 'number', description: 'How many shares to sell (defaults to all)' },
        },
        required: ['marketId'],
      },
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions selling shares but does not cover critical aspects like required permissions, market conditions, transaction costs, or response format. This leaves significant gaps for a mutation tool.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words, making it highly concise and front-loaded. It directly states the tool's purpose without unnecessary elaboration.

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?

For a mutation tool with no annotations and no output schema, the description is inadequate. It lacks details on behavioral traits, error conditions, and result expectations, leaving the agent with insufficient context to use the tool effectively.

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 description coverage is 100%, so the schema already documents all parameters. The description does not add any meaning beyond what the schema provides, such as explaining the implications of defaults or market interactions. Baseline 3 is appropriate as the schema handles parameter documentation.

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 clearly states the action ('sell') and resource ('shares in a market'), making the purpose evident. However, it does not differentiate from sibling tools like 'place_bet' or 'remove_liquidity', which might involve similar financial transactions, so it lacks sibling distinction.

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 is provided on when to use this tool versus alternatives such as 'place_bet' or 'remove_liquidity', nor does it mention prerequisites like market state or user holdings. The description only states what it does without context for usage.

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