Skip to main content
Glama
bmorphism

Manifold Markets MCP Server

sell_shares

Sell YES or NO shares from a prediction market. Specify the market ID and optionally the number of shares to sell.

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

  • Zod schema for validating sell_shares input parameters (marketId required, outcome and shares optional).
    const SellSharesSchema = z.object({
      marketId: z.string(),
      outcome: z.enum(['YES', 'NO']).optional(),
      shares: z.number().optional(),
    });
  • src/index.ts:277-289 (registration)
    Registration of the sell_shares tool in the list of available tools, defining its name, description, and input schema.
    {
      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'],
      },
    },
  • Handler logic for sell_shares: parses args, validates API key, POSTs to Manifold's sell endpoint, and returns the JSON result.
    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),
          },
        ],
      };
    }
Behavior2/5

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

With no annotations, the description carries full burden but only states the action 'sell shares'. It does not disclose behavioral traits such as side effects (e.g., share reduction, mana changes), authorization requirements, error conditions, or whether the operation is reversible.

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, very concise, but it may be too short to be informative. It lacks structure and front-loading of key details. While it has no fluff, it sacrifices completeness for brevity.

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 the tool has 3 required/optional parameters, no output schema, and no annotations, the description is insufficient. It does not explain return values, preconditions (e.g., must own shares to sell), or behavioral guarantees, leaving significant gaps for the AI agent.

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?

All three parameters are described in the input schema (100% coverage), so the description adds no extra meaning. For instance, 'marketId' is simply 'Market ID', and 'outcome' and 'shares' have default behaviors explained in the schema. Baseline is 3; description does not improve beyond that.

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 verb 'sell' and the resource 'shares in a market', effectively communicating the tool's purpose. However, it lacks specificity to distinguish it from sibling tools like 'cancel_bet' which might also involve selling back shares, but the resource 'shares' is distinct enough.

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?

The description provides no guidance on when to use this tool versus alternatives (e.g., 'place_bet', 'cancel_bet'). It does not mention prerequisites, expected outcomes, or exclusion criteria, leaving the AI agent without context for appropriate invocation.

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