Skip to main content
Glama
calebl

YNAB MCP Server

by calebl

List Payees

ynab_list_payees

Retrieve all payees from a YNAB budget to find specific payee IDs needed for creating or managing transactions.

Instructions

Lists all payees in a budget. Useful for finding payee IDs when creating transactions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budgetIdNoThe ID of the budget (optional, defaults to YNAB_BUDGET_ID environment variable)

Implementation Reference

  • The main handler function 'execute' that fetches payees from the YNAB API for the given budget, filters out deleted payees, formats the response as JSON, and handles errors.
    export async function execute(input: ListPayeesInput, api: ynab.API) {
      try {
        const budgetId = getBudgetId(input.budgetId);
    
        console.error(`Listing payees for budget ${budgetId}`);
        const response = await api.payees.getPayees(budgetId);
    
        // Filter out deleted payees and format the response
        const payees = response.data.payees
          .filter((payee) => !payee.deleted)
          .map((payee) => ({
            id: payee.id,
            name: payee.name,
            transfer_account_id: payee.transfer_account_id,
          }));
    
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify({
              payees,
              payee_count: payees.length,
            }, null, 2),
          }],
        };
      } catch (error) {
        console.error("Error listing payees:", error);
        return {
          content: [{
            type: "text" as const,
            text: JSON.stringify({
              success: false,
              error: getErrorMessage(error),
            }, null, 2),
          }],
        };
      }
    }
  • Input schema definition for the tool using Zod, specifying optional budgetId.
    export const inputSchema = {
      budgetId: z.string().optional().describe("The ID of the budget (optional, defaults to YNAB_BUDGET_ID environment variable)"),
    };
  • src/index.ts:81-85 (registration)
    Registers the 'ynab_list_payees' tool on the MCP server, providing title, description, inputSchema, and the execute handler wrapped with the YNAB API instance.
    server.registerTool(ListPayeesTool.name, {
      title: "List Payees",
      description: ListPayeesTool.description,
      inputSchema: ListPayeesTool.inputSchema,
    }, async (input) => ListPayeesTool.execute(input, api));
  • Helper function to retrieve or default the budget ID from input or environment variable.
    function getBudgetId(inputBudgetId?: string): string {
      const budgetId = inputBudgetId || process.env.YNAB_BUDGET_ID || "";
      if (!budgetId) {
        throw new Error("No budget ID provided. Please provide a budget ID or set the YNAB_BUDGET_ID environment variable.");
      }
      return budgetId;
    }
Behavior3/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 of behavioral disclosure. It implies a read-only operation ('Lists') and adds context about its utility for finding IDs, but it doesn't cover aspects like rate limits, error handling, or response format. This leaves gaps in behavioral understanding, though the basic action is clear.

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 front-loaded with the core purpose in the first sentence and adds a useful guideline in the second, with no wasted words. Both sentences earn their place by providing clear value, making it efficiently structured and appropriately sized for the tool's complexity.

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

Completeness4/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 (one optional parameter, no output schema, no annotations), the description is mostly complete: it states the purpose and usage context. However, it lacks details on behavioral aspects like response format or limitations, which could be helpful for an agent, though not critical for a simple list operation.

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?

The input schema has 100% description coverage, with the 'budgetId' parameter documented as optional with a default. The description doesn't add any parameter-specific details beyond what the schema provides, so it meets the baseline for high schema coverage without compensating with extra semantic information.

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 ('Lists') and resource ('all payees in a budget'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'ynab_list_accounts' or 'ynab_list_categories', which follow a similar pattern, so it doesn't fully distinguish itself.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('Useful for finding payee IDs when creating transactions'), which helps guide its application. However, it doesn't specify when not to use it or mention alternatives, such as whether other tools might list payees in a different way, so it's not fully explicit about usage boundaries.

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/calebl/ynab-mcp-server'

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