Skip to main content
Glama
baidu

Baidu Vector Database MCP Server

Official
by baidu

create_database

Create a new vector database in Baidu Cloud to store and organize vector embeddings for AI applications.

Instructions

Create a database in the Mochow instance.

Args:
    database_name (str): Name of the database.

Returns:
    str: A message indicating the success of database creation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
database_nameYes

Implementation Reference

  • MCP tool handler for 'create_database'. Registers the tool with FastMCP and implements the logic by delegating to MochowConnector.create_database.
    @mcp.tool()
    async def create_database(database_name: str, ctx: Context = None) -> str:
        """
        Create a database in the Mochow instance.
    
        Args:
            database_name (str): Name of the database.
    
        Returns:
            str: A message indicating the success of database creation.
        """
        connector = ctx.request_context.lifespan_context.connector
        await connector.create_database(database_name)
        return f"Created a database named '{database_name}'in Mochow instance:\n"
  • Helper method in MochowConnector class that performs the actual database creation using the pymochow client, first checking if it already exists.
    async def create_database(self, db_name: str) -> bool:
        """
        Create a new database.
    
        Args:
            db_name (str): Name of the database to create.
    
        Returns:
            bool: True if the database is created or already exists, False otherwise.
        """
        try:
            # database already existed
            for db in self.client.list_databases():
                if db.database_name == db_name:
                    return True
    
            # create the new database
            self.client.create_database(db_name)
            self.database = self.client.database(db_name)
            return True
        except Exception as e:
            raise ValueError(f"Failed to create database: {str(e)}")
  • FastMCP decorator that registers the create_database function as a tool.
    @mcp.tool()
  • Function signature and docstring defining the input schema (database_name: str) and output (str message).
    async def create_database(database_name: str, ctx: Context = None) -> str:
        """
        Create a database in the Mochow instance.
    
        Args:
            database_name (str): Name of the database.
    
        Returns:
            str: A message indicating the success of database creation.
        """
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the action 'Create' and a success message return, but lacks details on permissions needed, whether the operation is idempotent, error conditions, or side effects. This is insufficient for a mutation tool with zero annotation coverage.

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 for Args and Returns, and is front-loaded with the main purpose. It's concise with no wasted words, though it could be slightly more efficient by integrating the parameter info into the main sentence.

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 a database creation tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits, error handling, and doesn't fully compensate for the missing structured data, making it inadequate for safe and effective 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 schema description coverage is 0%, but the description adds the parameter 'database_name' with its type and purpose, providing basic semantics beyond the schema. However, it doesn't cover constraints like naming rules or length limits, leaving gaps in parameter understanding.

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 'Create' and resource 'database in the Mochow instance', making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'use_database' or 'list_databases', which would require a 5.

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 like 'use_database' or 'list_databases', nor does it mention prerequisites or exclusions. It's a basic statement of function without contextual usage advice.

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/baidu/mochow-mcp-server-python'

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