Skip to main content
Glama

get_list

Retrieve items from an existing list by ID to inspect contents, verify items, or check list existence for processing preparation.

Instructions

Retrieves the items in an existing list by its ID.

WHEN TO USE:

  • To inspect the contents of a list before processing

  • To verify which items are in a list

  • To check if a list exists

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
list_idYesThe list ID returned by create_list.

Implementation Reference

  • Executes the core logic of the get_list tool: retrieves list items by ID from the global 'lists' Map, formats them as a numbered list, or returns an error if the list doesn't exist.
    async ({ list_id }) => { const items = lists.get(list_id); if (!items) { return { content: [ { type: "text", text: `Error: No list found with ID "${list_id}". The list may have been deleted or the ID is incorrect.`, }, ], isError: true, }; } const itemList = items.map((item, i) => `${i + 1}. ${item}`).join("\n"); return { content: [ { type: "text", text: `List "${list_id}" contains ${items.length} items:\n\n${itemList}`, }, ], }; },
  • Zod schema defining the input parameter 'list_id' as a required string for the get_list tool.
    inputSchema: { list_id: z.string().describe("The list ID returned by create_list."), },
  • src/index.ts:311-349 (registration)
    Registers the get_list tool with the MCP server, providing name, description, input schema, and inline handler function.
    server.registerTool( "get_list", { description: `Retrieves the items in an existing list by its ID. WHEN TO USE: - To inspect the contents of a list before processing - To verify which items are in a list - To check if a list exists`, inputSchema: { list_id: z.string().describe("The list ID returned by create_list."), }, }, async ({ list_id }) => { const items = lists.get(list_id); if (!items) { return { content: [ { type: "text", text: `Error: No list found with ID "${list_id}". The list may have been deleted or the ID is incorrect.`, }, ], isError: true, }; } const itemList = items.map((item, i) => `${i + 1}. ${item}`).join("\n"); return { content: [ { type: "text", text: `List "${list_id}" contains ${items.length} items:\n\n${itemList}`, }, ], }; }, );

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/jrandolf/par5-mcp'

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