Skip to main content
Glama
Aas-ee
by Aas-ee

fetchCsdnArticle

Extract complete article content from CSDN post URLs. Simplify web searches by retrieving full-text data for analysis or integration without requiring API keys.

Instructions

Fetch full article content from a csdn post URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes

Implementation Reference

  • Core handler function that fetches CSDN article content via HTTP request with custom headers and extracts plain text using Cheerio.
    export async function fetchCsdnArticle(url: string): Promise<{ content: string }> {
    
        const response = await axios.get(url, {
            headers: {
                'Accept': '*/*',
                'Host': 'blog.csdn.net',
                'Connection': 'keep-alive',
                'Cookie': 'https_waf_cookie=771a8075-77ae-4b2cdf3bda08cd28ad372861867be773d8c1; uuid_tt_dd=10_20283045860-1751096847125-425142; dc_session_id=10_1751096847125.891975; waf_captcha_marker=318c5c7f316f665febdb746a58e039a681a94708df7a26376ed47720663cd99d',
                'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36',
            }
        });
    
        const $ = cheerio.load(response.data);
        const plainText = $('#content_views').text()
    
        return { content: plainText };
    }
  • MCP tool registration including configurable name, description, Zod input schema for URL validation, and async wrapper handler invoking the core function.
    server.tool(
        fetchCsdnToolName,
        "Fetch full article content from a csdn post URL",
        {
            url: z.string().url().refine(
                (url) => validateArticleUrl(url, 'csdn'),
                "URL must be from blog.csdn.net contains /article/details/ path"
            )
        },
        async ({url}) => {
            try {
                console.error(`Fetching CSDN article: ${url}`);
                const result = await fetchCsdnArticle(url);
    
                return {
                    content: [{
                        type: 'text',
                        text: result.content
                    }]
                };
            } catch (error) {
                console.error('Failed to fetch CSDN article:', error);
                return {
                    content: [{
                        type: 'text',
                        text: `Failed to fetch article: ${error instanceof Error ? error.message : 'Unknown error'}`
                    }],
                    isError: true
                };
            }
        }
  • Zod schema for input validation ensuring the URL is a valid CSDN article URL.
    {
        url: z.string().url().refine(
            (url) => validateArticleUrl(url, 'csdn'),
            "URL must be from blog.csdn.net contains /article/details/ path"
        )
    },
  • Helper function to validate article URLs for different sites including CSDN.
    const validateArticleUrl = (url: string, type: 'linuxdo' | 'csdn' | 'juejin'): boolean => {
        try {
            const urlObj = new URL(url);
    
            switch (type) {
                case 'linuxdo':
                    return urlObj.hostname === 'linux.do' && url.includes('.json');
                case 'csdn':
                    return urlObj.hostname === 'blog.csdn.net' && url.includes('/article/details/');
                case 'juejin':
                    return urlObj.hostname === 'juejin.cn' && url.includes('/post/');
                default:
                    return false;
            }
        } catch {
            return false;
        }
    };
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 action ('fetch full article content') but doesn't describe what 'full article content' includes (e.g., text, images, metadata), potential errors (e.g., invalid URLs, network issues), or any constraints (e.g., rate limits, authentication needs). This leaves significant gaps for an agent to understand how the tool behaves beyond the basic operation.

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, efficient sentence that front-loads the core action ('fetch full article content') and resource ('from a csdn post URL'). There is no wasted language, and it directly communicates the essential information without unnecessary elaboration.

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

Completeness3/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 (one parameter, no annotations, no output schema), the description is minimally complete. It covers the basic purpose but lacks details on usage guidelines, behavioral traits, and output specifics. For a simple fetch operation, this might be adequate, but it doesn't provide enough context for an agent to handle edge cases or alternatives effectively.

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 description implies the 'url' parameter must be a csdn post URL, which adds meaning beyond the schema's generic URI format. However, with 0% schema description coverage and only one parameter, the baseline is 4 for zero parameters, but here one parameter is partially clarified. The description doesn't specify URL format details (e.g., must include 'csdn.net'), so it compensates somewhat but not fully.

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 verb 'fetch' and the resource 'full article content from a csdn post URL', making the purpose immediately understandable. It distinguishes from siblings like fetchGithubReadme by specifying the source (csdn) and content type (article), though it doesn't explicitly contrast with other article-fetching siblings like fetchJuejinArticle or fetchLinuxDoArticle.

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 when to choose fetchCsdnArticle over fetchJuejinArticle or fetchLinuxDoArticle, nor does it indicate any prerequisites or exclusions. The only implied usage is for csdn URLs, but this is already covered in the purpose.

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/Aas-ee/open-webSearch'

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