Skip to main content
Glama

List Hand

list_hand

View cards in your personal work queue, sorted by hand order, to manage project tasks and track progress.

Instructions

List cards in the user's hand (personal work queue), sorted by hand order.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool registration and handler for 'list_hand'. This is where the tool is registered with the server with its schema (no input required) and the async handler function that executes the logic. The handler calls client.listHand(), sanitizes the results using sanitizeCard() and slimCard(), and returns the formatted JSON response.
    server.registerTool(
      "list_hand",
      {
        title: "List Hand",
        description: "List cards in the user's hand (personal work queue), sorted by hand order.",
        inputSchema: z.object({}),
      },
      async () => {
        try {
          const result = await client.listHand();
          const sanitized = result.map((c) => sanitizeCard(slimCard(c)));
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(finalizeToolResult(sanitized)),
              },
            ],
          };
        } catch (err) {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(finalizeToolResult(handleError(err))),
              },
            ],
          };
        }
      },
    );
  • The CodecksClient.listHand() method implementation. This is the core business logic that executes an authenticated GraphQL query to fetch the user's hand cards with fields (id, title, status, priority, deck.title), then extracts the handCards array from the response using extractList().
    async listHand(): Promise<Record<string, unknown>[]> {
      const result = await query({
        _root: [
          {
            account: [
              {
                handCards: ["id", "title", "status", "priority", { deck: ["title"] }],
              },
            ],
          },
        ],
      });
      return this.extractList(result, "handCards");
    }
  • The slimCard() helper function. Removes unnecessary nested fields (deckId, milestoneId, projectId, childCardInfo, masterTags) from card objects to reduce response size and avoid circular references.
    function slimCard(card: Record<string, unknown>): Record<string, unknown> {
      const out: Record<string, unknown> = {};
      for (const [k, v] of Object.entries(card)) {
        if (!SLIM_DROP.has(k)) out[k] = v;
      }
      return out;
    }
  • The extractList() private helper method. Navigates through potentially nested API response objects to find and extract an array by key name. Used to extract the handCards array from the query response.
    private extractList(result: Record<string, unknown>, key: string): Record<string, unknown>[] {
      for (const val of Object.values(result)) {
        if (typeof val === "object" && val !== null) {
          const obj = val as Record<string, unknown>;
          if (Array.isArray(obj[key])) return obj[key] as Record<string, unknown>[];
          for (const inner of Object.values(obj)) {
            if (typeof inner === "object" && inner !== null) {
              const innerObj = inner as Record<string, unknown>;
              if (Array.isArray(innerObj[key])) return innerObj[key] as Record<string, unknown>[];
            }
          }
        }
      }
      return [];
    }
  • The sanitizeCard() security function. Detects potential injection patterns in user-generated text fields (title, content) and tags them with [USER_DATA] markers. Adds safety warnings if suspicious patterns are found.
    export function sanitizeCard(card: Record<string, unknown>): Record<string, unknown> {
      const out = { ...card };
      const warnings: string[] = [];
    
      for (const field of USER_TEXT_FIELDS) {
        if (field in out && typeof out[field] === "string") {
          for (const desc of checkInjection(out[field] as string)) {
            warnings.push(`${field}: ${desc}`);
          }
          out[field] = tagUserText(out[field] as string);
        }
      }
    
      if (Array.isArray(out.sub_cards)) {
        out.sub_cards = (out.sub_cards as Record<string, unknown>[]).map((sc) => {
          const tagged = { ...sc };
          if (typeof tagged.title === "string") {
            for (const desc of checkInjection(tagged.title as string)) {
              warnings.push(`sub_card.title: ${desc}`);
            }
            tagged.title = tagUserText(tagged.title as string);
          }
          return tagged;
        });
      }
    
      if (Array.isArray(out.conversations)) {
        out.conversations = (out.conversations as Record<string, unknown>[]).map((conv) => {
          const tagged = { ...conv };
          if (Array.isArray(tagged.messages)) {
            tagged.messages = (tagged.messages as Record<string, unknown>[]).map((msg) => {
              const m = { ...msg };
              if (typeof m.content === "string") {
                for (const desc of checkInjection(m.content as string)) {
                  warnings.push(`conversation.message: ${desc}`);
                }
                m.content = tagUserText(m.content as string);
              }
              return m;
            });
          }
          return tagged;
        });
      }
    
      if (warnings.length > 0) {
        out._safety_warnings = warnings;
      }
    
      return out;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions sorting by 'hand order', which adds some behavioral context, but lacks details on permissions, rate limits, pagination, or what happens if the hand is empty. For a read operation with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 that front-loads the core purpose ('List cards in the user's hand') and adds clarifying details ('personal work queue, sorted by hand order') without any wasted words. Every part contributes meaning, making it highly concise and well-structured.

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?

Given the tool's low complexity (0 parameters, no output schema, no annotations), the description is minimally adequate. It explains what the tool does and the sorting behavior, but as a read operation with no annotations, it could benefit from more context on permissions or output format to be fully complete for an agent.

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?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately adds no parameter details, focusing instead on the tool's purpose and behavior, which aligns with the baseline expectation for zero-parameter tools.

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 ('List cards') and the target resource ('in the user's hand'), with the clarifying note that this refers to a 'personal work queue'. It distinguishes from generic list tools like 'list_cards' by specifying the hand context, though it doesn't explicitly contrast with 'remove_from_hand' or 'add_to_hand'.

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 explicit guidance is provided on when to use this tool versus alternatives. While it implies usage for viewing the hand's contents, it doesn't mention when to choose this over 'list_cards' (which might list all cards) or other sibling tools, nor does it specify prerequisites or exclusions.

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/rangogamedev/codecks-mcp'

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