Skip to main content
Glama

get_list

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

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

  • src/index.ts:298-336 (registration)
    Registration of the 'get_list' tool, including description, input schema, and the inline handler function that retrieves and formats the list contents or returns an error if not found.
    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}`,
    				},
    			],
    		};
    	},
    );
  • The handler function for 'get_list' tool. It fetches the list items using lists.get(list_id), handles missing list with error response, otherwise formats the items into a numbered list and returns as text content.
    	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 input schema for 'get_list' tool, defining the required 'list_id' parameter.
    inputSchema: {
    	list_id: z.string().describe("The list ID returned by create_list."),
    },
  • Global Map<string, string[]> named 'lists' that stores all created lists, used by the get_list handler via lists.get(list_id).
    const lists = new Map<string, string[]>();
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. It states this is a retrieval operation ('Retrieves'), implying it's likely read-only, but doesn't explicitly confirm safety or mention potential errors (e.g., if list_id is invalid). It adds some context about checking existence, but lacks details on return format, pagination, or rate limits.

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 well-structured with a clear purpose statement followed by a bulleted 'WHEN TO USE' section. Every sentence earns its place by providing actionable guidance without redundancy. It's appropriately sized for a simple retrieval tool.

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 (single parameter, no output schema, no annotations), the description is reasonably complete. It covers purpose, usage guidelines, and parameter context. However, without annotations or output schema, it could better address behavioral aspects like error handling or return format.

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%, with the schema fully documenting the single parameter list_id. The description adds minimal value beyond the schema, only implying that list_id comes from create_list. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Retrieves the items in an existing list') and resource ('by its ID'), distinguishing it from siblings like create_list, delete_list, and list_all_lists. It explicitly mentions retrieving items rather than metadata or performing operations on the list.

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

Usage Guidelines5/5

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

The 'WHEN TO USE' section provides explicit guidance with three bullet points: inspecting contents before processing, verifying items, and checking existence. This clearly indicates when to use this tool versus alternatives like list_all_lists (for listing lists) or run_agent_across_list (for processing items).

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

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