Skip to main content
Glama

Extract keywords

extract_keywords
Read-only

Extract important keywords from Chinese text using TF-IDF or TextRank ranking. Set top_k, filter by part-of-speech, and optionally include weights for each keyword.

Instructions

Extract the most important keywords from Chinese text.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "text": "<text>"
    },
    "name": "extract_keywords"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYesChinese text to process.
top_kNoMaximum number of keywords.
methodNotfidf: rank by TF-IDF against jieba's built-in IDF table; textrank: graph-based ranking of co-occurring words.tfidf
allow_posNoOnly keep words with these POS tags, e.g. ["n", "ns", "vn"]. Default: no filter for tfidf, ["ns", "n", "vn", "v"] for textrank.
with_weightNoInclude each keyword's score.

Output Schema

NameRequiredDescriptionDefault
methodYes
keywordsYesKeywords, highest score first.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so the safety profile is covered. The description adds the meaningful constraint that input must be Chinese text, but says nothing about determinism, ordering of returned keywords, or behavior when no keywords qualify.

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?

A single front-loaded sentence with no filler, but its brevity borders on under-specification for a tool with five parameters and two ranking methods.

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?

Rich structured data (full schema descriptions, an output schema, and annotations) carries most of the burden, so the thin description is tolerable. Still, guidance on when tfidf versus textrank is appropriate, or what the tool is not for, would round it out.

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?

Schema coverage is 100% and each parameter, including the tfidf/textrank method trade-off and POS tag filtering, is fully documented in the schema. The description adds no parameter meaning beyond that, which is the expected baseline when the schema does the work.

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?

States a specific verb (Extract) and resource (keywords) and scopes the input domain to Chinese text, which cleanly separates it from generic text utilities like convert_chinese or segment. It does not explicitly contrast with the POS-tagging or segmentation siblings, so the differentiation is implied rather than stated.

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 gives no guidance on when to choose this tool over segment or pos_tag, nor any prerequisites, exclusions, or typical use cases. The agent must infer applicability from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.