Skip to main content
Glama
matthewdtowles

iwantmymtg-mcp

get_cash_flow

Retrieves net cash flow from buy and sell transactions to track your financial position.

Instructions

Get the user's cash flow (money in vs money out from BUY/SELL transactions). Premium-gated. Requires IWMM_API_KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The `getCashFlowTool` object defines the tool's handler function, which calls `apiFetch({ path: '/api/v1/portfolio/cash-flow', authenticated: true })` to fetch cash flow data from the IWMM API.
    export const getCashFlowTool = {
      name: "get_cash_flow",
      description:
        "Get the user's cash flow (money in vs money out from BUY/SELL transactions). Premium-gated. Requires IWMM_API_KEY.",
      inputSchema: z.object({}),
      handler: () => apiFetch({ path: "/api/v1/portfolio/cash-flow", authenticated: true }),
    };
  • The input schema for get_cash_flow uses Zod validation with an empty object (`z.object({})`), meaning the tool accepts no parameters.
    inputSchema: z.object({}),
  • The tool is registered in the `tools` array (line 74) and also accessible via `toolsByName` (line 90-92), which maps tool names to their definitions.
    getCashFlowTool,
    getRealizedGainsTool,
    getPortfolioBreakdownTool,
    refreshPortfolioTool,
  • The `apiFetch` helper function used by the handler to make authenticated HTTP requests to the IWMM API. It adds the Authorization header when `authenticated: true`.
    export async function apiFetch<T = unknown>(req: ApiRequest): Promise<T> {
      const url = new URL(req.path, config.baseUrl);
      if (req.query) {
        for (const [k, v] of Object.entries(req.query)) {
          if (v !== undefined && v !== null && v !== "") {
            url.searchParams.set(k, String(v));
          }
        }
      }
    
      const headers: Record<string, string> = {
        Accept: "application/json",
        "User-Agent": "iwantmymtg-mcp/0.0.1",
      };
    
      if (req.authenticated) {
        const { requireApiKey } = await import("./config.js");
        headers["Authorization"] = `Bearer ${requireApiKey()}`;
      }
    
      if (req.body !== undefined) {
        headers["Content-Type"] = "application/json";
      }
    
      const res = await fetch(url, {
        method: req.method ?? "GET",
        headers,
        body: req.body !== undefined ? JSON.stringify(req.body) : undefined,
      });
    
      if (!res.ok) {
        const text = await res.text();
        throw new ApiError(res.status, text, {
          limit: res.headers.get("X-RateLimit-Limit") ?? undefined,
          remaining: res.headers.get("X-RateLimit-Remaining") ?? undefined,
          reset: res.headers.get("X-RateLimit-Reset") ?? undefined,
        });
      }
    
      if (res.status === 204) return undefined as T;
      return (await res.json()) as T;
    }
Behavior3/5

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

Discloses it is a premium-gated read operation and requires IWMM_API_KEY. No discussion of side effects, rate limits, or return structure. Lacks detail for an unannotated 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?

Two short sentences, front-loaded with purpose, then constraints. Every word earns its place.

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

Completeness3/5

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

Covers purpose and auth, but with no output schema or annotations, the description leaves gaps (e.g., time period, return format). Adequate for a simple tool but not fully complete.

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

Parameters4/5

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

No parameters exist; schema coverage is 100% trivially. Description adds no parameter info, but baseline for zero-param tools is 4.

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

Purpose5/5

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

Clearly states tool retrieves cash flow (money in vs out from BUY/SELL transactions). Differentiates from siblings like get_cost_basis or get_realized_gains by focusing on net cash movement from trades.

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

Usage Guidelines3/5

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

Mentions premium gating and API key requirement, giving prerequisites. No explicit guidance on when to use vs alternatives; context is implied but not compared to sibling financial tools.

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/matthewdtowles/iwantmymtg-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server