Skip to main content
Glama
davidashman

AnyList MCP Server

by davidashman

Get List Items

get_list_items

Retrieve all items from a specific shopping list in AnyList. Use this tool to view list contents for shopping or meal planning.

Instructions

Get all items on a specific shopping list.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
list_nameYesName of the list to retrieve items from

Implementation Reference

  • The handler function for 'get_list_items' that fetches the specified list and formats its items.
    async ({ list_name }) => {
      try {
        const client = AnyListClient.getInstance();
        await client.getLists();
        const list = client.getListByName(list_name);
    
        if (!list) {
          return {
            content: [{ type: 'text', text: `List not found: "${list_name}"` }],
            isError: true,
          };
        }
    
        const result = list.items.map((i) => ({
          id: i.identifier,
          name: i.name,
          quantity: i.quantity ?? null,
          details: i.details ?? null,
          checked: i.checked,
        }));
    
        return {
          content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
        };
      } catch (error) {
        return {
          content: [{ type: 'text', text: `Error fetching list items: ${error instanceof Error ? error.message : String(error)}` }],
          isError: true,
        };
      }
    },
  • Input schema definition for the 'get_list_items' tool.
    {
      title: 'Get List Items',
      description: 'Get all items on a specific shopping list.',
      inputSchema: z.object({
        list_name: z.string().describe('Name of the list to retrieve items from'),
      }),
    },
  • Registration call for the 'get_list_items' tool.
    server.registerTool(
      'get_list_items',
      {
        title: 'Get List Items',
        description: 'Get all items on a specific shopping list.',
        inputSchema: z.object({
          list_name: z.string().describe('Name of the list to retrieve items from'),
        }),
      },
      async ({ list_name }) => {
        try {
          const client = AnyListClient.getInstance();
          await client.getLists();
          const list = client.getListByName(list_name);
    
          if (!list) {
            return {
              content: [{ type: 'text', text: `List not found: "${list_name}"` }],
              isError: true,
            };
          }
    
          const result = list.items.map((i) => ({
            id: i.identifier,
            name: i.name,
            quantity: i.quantity ?? null,
            details: i.details ?? null,
            checked: i.checked,
          }));
    
          return {
            content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
          };
        } catch (error) {
          return {
            content: [{ type: 'text', text: `Error fetching list items: ${error instanceof Error ? error.message : String(error)}` }],
            isError: true,
          };
        }
      },
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Get' implies a read-only operation, the description lacks critical details: return format, behavior when list_name doesn't exist, or whether results are paginated for large lists.

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?

Extremely concise at 7 words in a single sentence. No filler words or redundant information. Immediately front-loaded with the action and target 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?

For a single-parameter read operation, the description meets minimum viability but has clear gaps. Without an output schema or annotations, it should at least mention error conditions (e.g., list not found) or return value structure to be complete.

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%, so the schema fully documents the list_name parameter. The description adds minimal semantic value beyond the schema, merely referencing a 'specific shopping list' without adding format constraints, examples, or validation rules.

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 ('Get') and resource ('items on a specific shopping list'). It implicitly distinguishes from sibling 'get_lists' by specifying 'items' versus lists, though it could explicitly clarify this distinction.

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 guidance provided on when to use this tool versus alternatives like 'get_lists' (which retrieves the lists themselves). Does not mention prerequisite steps like obtaining the list_name or error handling if the list doesn't exist.

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/davidashman/anylist-mcp'

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