Skip to main content
Glama

Resolve Context7 Library ID

resolve-library-id
Read-only

Resolves package names to Context7-compatible library IDs for accurate documentation retrieval. Use before querying docs to ensure correct library identification and matching results.

Instructions

Resolves a package/product name to a Context7-compatible library ID and returns matching libraries.

You MUST call this function before 'query-docs' to obtain a valid Context7-compatible library ID UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.

Selection Process:

  1. Analyze the query to understand what library/package the user is looking for

  2. Return the most relevant match based on:

  • Name similarity to the query (exact matches prioritized)

  • Description relevance to the query's intent

  • Documentation coverage (prioritize libraries with higher Code Snippet counts)

  • Source reputation (consider libraries with High or Medium reputation more authoritative)

  • Benchmark Score: Quality indicator (100 is the highest score)

Response Format:

  • Return the selected library ID in a clearly marked section

  • Provide a brief explanation for why this library was chosen

  • If multiple good matches exist, acknowledge this but proceed with the most relevant one

  • If no good matches exist, clearly state this and suggest query refinements

For ambiguous queries, request clarification before proceeding with a best-guess match.

IMPORTANT: Do not call this tool more than 3 times per question. If you cannot find what you need after 3 calls, use the best result you have.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe user's original question or task. This is used to rank library results by relevance to what the user is trying to accomplish. IMPORTANT: Do not include any sensitive or confidential information such as API keys, passwords, credentials, or personal data in your query.
libraryNameYesLibrary name to search for and retrieve a Context7-compatible library ID.
Behavior4/5

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

The annotations indicate readOnlyHint=true, which the description aligns with by describing a resolution/search operation. The description adds valuable behavioral context beyond annotations: it details the selection process (5 criteria), response format, handling of ambiguous queries, and a usage limit ('Do not call this tool more than 3 times per question'). This enriches the agent's understanding of how the tool behaves in practice.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose and usage guidelines, but it includes extensive procedural details (e.g., the 5-step selection process, response format instructions) that may be verbose for a tool description. While informative, some of this could be streamlined or moved to documentation, as it risks overwhelming the agent with implementation specifics rather than high-level guidance.

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 complexity (involving a multi-criteria selection process) and the absence of an output schema, the description provides substantial context: it explains the selection logic, response format, error handling, and usage limits. This compensates well for the lack of structured output information, though it could benefit from a brief example of the output structure to enhance clarity.

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, clearly explaining both 'query' and 'libraryName' parameters. The description does not add significant semantic details beyond what the schema provides, such as clarifying the relationship between the two parameters or providing examples. However, it implies the parameters are used in the selection process described, which offers some contextual value.

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 tool's purpose: 'Resolves a package/product name to a Context7-compatible library ID and returns matching libraries.' It specifies the verb ('resolves'), resource ('package/product name'), and output ('library ID and matching libraries'), and distinguishes it from its sibling 'query-docs' by explaining the prerequisite relationship.

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 description provides explicit guidance on when to use this tool: 'You MUST call this function before 'query-docs' to obtain a valid Context7-compatible library ID UNLESS the user explicitly provides a library ID...' It also specifies when not to use it (if a library ID is already provided) and names the alternative ('query-docs'), covering both inclusion and exclusion criteria.

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/upstash/context7-mcp'

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