Skip to main content
Glama
Jtewen

You Need A Budget (YNAB) MCP

by Jtewen

lookup-entity-by-id

Retrieve detailed information about an account, category, or payee in YNAB by specifying its ID. Use this tool to identify entities when only their ID is known.

Instructions

Look up the name and details of a specific account, category, or payee by its ID. A utility for when you have an ID but need the full context.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budget_idNoThe ID of the budget. If not provided, the default budget will be used.
entity_idYesThe ID of the entity to look up.
entity_typeYesThe type of entity to look up.

Implementation Reference

  • The handler function within the @server.call_tool() decorator that implements the core logic for the "lookup-entity-by-id" tool. It validates the input using LookupEntityByIdInput, retrieves the budget ID, calls appropriate ynab_client methods based on entity_type, and formats the response.
    elif name == "lookup-entity-by-id":
        args = LookupEntityByIdInput.model_validate(arguments or {})
        budget_id = await _get_budget_id(args.model_dump())
    
        entity = None
        if args.entity_type == "account":
            entity = await ynab_client.get_account_by_id(budget_id, args.entity_id)
        elif args.entity_type == "category":
            entity = await ynab_client.get_category_by_id(budget_id, args.entity_id)
        elif args.entity_type == "payee":
            entity = await ynab_client.get_payee_by_id(budget_id, args.entity_id)
    
        if not entity:
            return [
                types.TextContent(
                    type="text",
                    text=f"No {args.entity_type} found with ID {args.entity_id}.",
                )
            ]
    
        entity_dict = entity.to_dict()
        return [
            types.TextContent(
                type="text",
                text=f"Found {args.entity_type}:\n{json.dumps(entity_dict, indent=2, default=str)}",
            )
        ]
  • Pydantic input schema model for the tool, including EntityType enum and fields for entity_type and entity_id, inheriting from BudgetIdInput.
    class EntityType(str, Enum):
        ACCOUNT = "account"
        CATEGORY = "category"
        PAYEE = "payee"
    
    
    class LookupEntityByIdInput(BudgetIdInput):
        entity_type: EntityType = Field(..., description="The type of entity to look up.")
        entity_id: str = Field(..., description="The ID of the entity to look up.")
  • Tool registration in the @server.list_tools() handler, specifying name, description, and inputSchema derived from the Pydantic model.
    types.Tool(
        name="lookup-entity-by-id",
        description="Look up the name and details of a specific account, category, or payee by its ID. A utility for when you have an ID but need the full context.",
        inputSchema=LookupEntityByIdInput.model_json_schema(),
    ),
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 of behavioral disclosure. It states this is a lookup/read operation, which implies it's non-destructive, but doesn't address potential behavioral aspects like error handling (e.g., what happens if the ID is invalid), authentication needs, rate limits, or the format of returned details. For a tool with no annotation coverage, this leaves significant gaps in understanding how it behaves.

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 appropriately sized and front-loaded: the first sentence states the core purpose, and the second sentence adds useful context. Every sentence earns its place with no wasted words, making it easy to scan and understand quickly.

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 moderate complexity (3 parameters, no output schema, no annotations), the description is adequate but has clear gaps. It covers the basic purpose and usage context, but without annotations or an output schema, it lacks details on behavioral traits, error handling, and the structure of returned 'details.' This makes it minimally viable but incomplete for full agent understanding.

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 description coverage is 100%, so the schema already documents all three parameters (budget_id, entity_id, entity_type) with descriptions. The description adds marginal value by implying the tool works with 'account, category, or payee' (mapping to entity_type) and 'ID' (mapping to entity_id), but doesn't provide additional syntax, format, or usage details beyond what the schema provides. Baseline 3 is appropriate when the schema does the heavy lifting.

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 tool's purpose: 'Look up the name and details of a specific account, category, or payee by its ID.' It specifies the verb ('look up'), resource ('account, category, or payee'), and key constraint ('by its ID'). However, it doesn't explicitly differentiate from sibling tools like 'list-accounts' or 'list-payees' beyond the ID-based lookup aspect.

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: 'A utility for when you have an ID but need the full context.' This implies it's for retrieving details of known entities, contrasting with list tools that might be used for discovery. However, it doesn't explicitly state when not to use it or name specific alternatives among siblings.

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

Related 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/Jtewen/ynab-mcp'

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