---
name: "xpay-context7-resolve-library-id"
description: "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."
version: "1.0.0"
price: "$0.01/call"
provider: "Context7"
---

# Resolve Library Id

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.

**Provider:** Context7
**Price:** $0.01/call
**Pricing model:** Flat rate per call

## When to Use

Use this tool when you need to 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.. This is part of the Context7 provider on xpay✦.

## MCP Connection

Connect to xpay✦ to access this tool (and 1+ others):

```json
{
  "mcpServers": {
    "xpay": {
      "url": "https://mcp.xpay.sh/mcp?key=YOUR_API_KEY"
    }
  }
}
```

For Claude Code:
```bash
claude mcp add --transport http xpay "https://mcp.xpay.sh/mcp?key=YOUR_API_KEY"
```

## How to Execute

Use the xpay✦ meta-tools to run this tool:

1. **`xpay_details`** — Get full input schema: `xpay_details("context7/resolve-library-id")`
2. **`xpay_run`** — Execute: `xpay_run("context7/resolve-library-id", { ...inputs })`

## Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `libraryName` | string | Yes | Library name to search for and retrieve a Context7-compatible library ID. |
| `query` | string | Yes | The question or task you need help with. This is used to rank library results by relevance to what the user is trying to accomplish. The query is sent to the Context7 API for processing. Do not include any sensitive or confidential information such as API keys, passwords, credentials, personal data, or proprietary code in your query. |

## Pricing

- **Cost:** $0.01/call
- **Balance check:** Use `xpay_balance` to check remaining credits
- Get your API key at [xpay.tools](https://xpay.tools/account/settings/api-keys/) — $5 free credits included

## Related Skills

- [Context7 (all tools)](https://xpay.tools/skills/context7/SKILL.md) — 2 tools
- [Query Docs](https://xpay.tools/skills/context7/query-docs/SKILL.md) — $0.01/call

## Links

- Tool page: https://xpay.tools/context7/resolve-library-id/
- Provider: https://xpay.tools/context7/
- All tools: https://xpay.tools/explore
