Skip to main content
Glama

sodax_get_user_position

Read-only

Retrieve a user's lending and borrowing position in a money market by wallet address. Returns data in JSON or markdown format.

Instructions

Get a user's lending and borrowing position in the money market

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userAddressYesThe wallet address to look up
formatNoResponse format: 'json' for raw data or 'markdown' for formatted textmarkdown

Implementation Reference

  • MCP tool handler for 'sodax_get_user_position' — registers the tool with the MCP server, accepts userAddress and optional format params, calls getUserPosition service, and formats the response as markdown or JSON.
    // Tool 8: Get User Position
    server.tool(
      "sodax_get_user_position",
      "Get a user's lending and borrowing position in the money market",
      {
        userAddress: z.string()
          .describe("The wallet address to look up"),
        format: z.nativeEnum(ResponseFormat).optional().default(ResponseFormat.MARKDOWN)
          .describe("Response format: 'json' for raw data or 'markdown' for formatted text")
      },
      READ_ONLY,
      async ({ userAddress, format }) => {
        try {
          const position = await getUserPosition(userAddress);
          if (!position) {
            return {
              content: [{ type: "text", text: `No money market position found for ${userAddress}` }]
            };
          }
          return {
            content: [{
              type: "text",
              text: `## Money Market Position\n\n**Address:** ${userAddress}\n\n` + formatResponse(position, format)
            }]
          };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : "Unknown error"}` }],
            isError: true
          };
        }
      }
    );
  • TypeScript interface 'UserPosition' defining the shape of the position data returned by the tool (address, totalSupplyUsd, totalBorrowUsd, healthFactor, netApy, supplies/borrows arrays).
    export interface UserPosition {
      address: string;
      chainId?: string;
      totalSupplyUsd: number;
      totalBorrowUsd: number;
      healthFactor: number;
      netApy: number;
      supplies: {
        asset: string;
        symbol: string;
        amount: string;
        valueUsd: number;
        apy: number;
      }[];
      borrows: {
        asset: string;
        symbol: string;
        amount: string;
        valueUsd: number;
        apy: number;
      }[];
    }
  • Backend service function 'getUserPosition' — fetches the user's money market position from SODAX API via GET /moneymarket/position/{userAddress}. Returns null on 404.
     * Get user's money market position
     */
    export async function getUserPosition(
      userAddress: string
    ): Promise<UserPosition | null> {
      try {
        const response = await apiClient.get(`/moneymarket/position/${userAddress}`);
        return response.data?.data || response.data || null;
      } catch (error) {
        if (axios.isAxiosError(error) && error.response?.status === 404) {
          return null;
        }
        console.error("Error fetching user position:", error);
        throw new Error("Failed to fetch user position from SODAX API");
      }
    }
  • src/index.ts:44-44 (registration)
    Registration entry point — calls registerSodaxApiTools(server) which registers all SODAX tools including sodax_get_user_position on the MCP server.
    registerSodaxApiTools(server);
  • Analytics group mapping — maps 'sodax_get_user_position' tool name to the 'api' group for PostHog analytics tracking.
    sodax_get_user_position: "api",
Behavior3/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the agent knows it's a safe read. Description adds no further behavioral context (e.g., error behavior, data scope), but does not contradict annotations. With annotations present, the description provides minimal additional value.

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?

Description is a single concise sentence (10 words) with no redundant information. It efficiently communicates the tool's purpose with front-loaded verb and resource.

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?

While the tool is simple and annotations cover safety, the description does not specify what 'position' entails (e.g., does it include collateral, debt, interest rates?) or output format. It is minimally adequate but could be more informative.

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% with clear descriptions for both parameters. The description does not elaborate on parameters beyond what the schema already provides, so it adds no extra semantic meaning.

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?

Description clearly states a specific verb 'Get' and resource 'user's lending and borrowing position in the money market'. It distinguishes from sibling tools that focus on lists (e.g., get_asset_borrowers) or different aspects, making it clear this retrieves a single user's position.

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?

Description provides no guidance on when to use this tool versus alternatives. Given many sibling tools with overlapping domains (e.g., get_asset_borrowers, get_user_transactions), explicit usage context is 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/gosodax/builders-sodax-mcp-server'

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