Skip to main content
Glama

get_apifox_project_id_and_api_id_from_url

Extract Apifox project ID and API ID directly from a provided URL to enable integration and understanding of API details within Apifox projects.

Instructions

Get the project ID and API ID of Apifox from the URL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesThe text to extract the project id and api id from

Implementation Reference

  • Handler function for the tool that extracts projectId and apiId from text using a helper and returns as JSON string.
    ({ text }) => {
       const { projectId, apiId } = extractProjectIdAndApiIdFromText(text)
    
    	return {
    		content: [
    			{
    				type: "text",
    				text: JSON.stringify({ projectId, apiId }),
    			},
    		],
    	}
    },
  • Input schema defining the 'text' parameter as a string.
    {
    	text: z
    		.string()
    		.describe("The text to extract the project id and api id from"),
    },
  • src/index.ts:13-33 (registration)
    Registers the MCP tool 'get_apifox_project_id_and_api_id_from_url' with description, input schema, and handler function.
    server.tool(
    	"get_apifox_project_id_and_api_id_from_url",
    	"Get the project ID and API ID of Apifox from the URL.",
    	{
    		text: z
    			.string()
    			.describe("The text to extract the project id and api id from"),
    	},
    	({ text }) => {
        const { projectId, apiId } = extractProjectIdAndApiIdFromText(text)
    
    		return {
    			content: [
    				{
    					type: "text",
    					text: JSON.stringify({ projectId, apiId }),
    				},
    			],
    		}
    	},
    )
  • Supporting utility that implements the extraction logic using regex to find project ID and API ID from Apifox URLs or paths in the input text.
    export function extractProjectIdAndApiIdFromText(text: string) {
    	const urlPattern = /apifox\.com\/link\/project\/(\d+)\/apis\/api-(\d+)/
    	const contentPattern = /project\/(\d+).*api-(\d+)/
    
    		let projectId = ""
    		let apiId = ""
    
    		// 寻找输入中的 URL 或相关内容
    		const lines = text.split("\n")
    		for (const line of lines) {
    			const trimmedLine = line.trim()
    
    			// 尝试匹配完整 URL
    			const urlMatch = trimmedLine.match(urlPattern)
    			if (urlMatch) {
    				projectId = urlMatch[1]
    				apiId = urlMatch[2]
    				break
    			}
    
    			// 尝试匹配部分路径
    			const contentMatch = trimmedLine.match(contentPattern)
    			if (contentMatch) {
    				projectId = contentMatch[1]
    				apiId = contentMatch[2]
    				break
    			}
    		}
    
    
      return {
        projectId,
        apiId
      }
    }
Behavior2/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 of behavioral disclosure. It states the tool extracts IDs from a URL but doesn't describe how it handles invalid inputs, errors, or the format of the extracted data. For a tool with no annotations, this is a significant gap in transparency about its operation and potential limitations.

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 a single, clear sentence that efficiently conveys the tool's purpose without unnecessary words. It is front-loaded with the main action and resource, making it easy to understand at a glance. Every part of the sentence contributes directly to the tool's definition.

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

Completeness2/5

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

Given the complexity of extracting IDs from text, the lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the output looks like (e.g., structured data, error messages) or how it handles edge cases. For a tool with one parameter but no behavioral context, this falls short of providing enough information for reliable use.

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, with the 'text' parameter documented as 'The text to extract the project id and api id from.' The description adds minimal value beyond this, only implying that the text should be a URL. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't provide additional syntax or format details.

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

Purpose4/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: 'Get the project ID and API ID of Apifox from the URL.' It specifies the verb ('Get') and the resources ('project ID and API ID'), and mentions the source ('from the URL'). However, it doesn't explicitly differentiate from the sibling tool 'get_apifox_api_info', which might have overlapping or related functionality.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention the sibling tool 'get_apifox_api_info' or any other context for usage, such as prerequisites or scenarios where this extraction is needed. This leaves the agent without clear direction on tool selection.

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

Related 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/sujianqingfeng/mcp-apifox'

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