Skip to main content
Glama

Resolve Context7 Library ID

resolve-library-id
Read-only

Resolve a library name to a Context7-compatible ID for documentation queries. Selects the best match based on relevance, reputation, and coverage.

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?

Annotations indicate readOnlyHint=true, which is consistent with the tool's purpose. The description adds important behavioral details beyond annotations, such as a 3-call limit per question, handling of ambiguous queries, and a warning not to include sensitive information in the 'query' parameter.

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

Conciseness4/5

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

The description is well-structured with clear sections, but it is somewhat lengthy. It front-loads the essential purpose and usage note, but the selection process details could be more succinct. Still, it remains clear and organized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given there is no output schema, the description adequately explains the response format. It covers edge cases like multiple matches, no matches, and ambiguous queries, providing complete guidance for the agent to handle various scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds value by explaining the role of each parameter: 'libraryName' is the name to search for, and 'query' is the user's original question used for ranking. It also includes a critical warning about sensitive data in 'query', which enhances understanding.

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?

Clearly states that the tool resolves a package/product name to a Context7-compatible library ID. It distinguishes itself from the sibling tool 'query-docs' by noting it must be called first, and includes specific details about selection criteria and response format.

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?

Explicitly specifies when to call this tool: before 'query-docs' unless the user provides a library ID in a specific format. It also provides a detailed selection process and response format, guiding the agent on how to use the tool correctly.

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'

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