Skip to content

Commit 3f0c554

Browse files
committed
feat: improve MCP tool descriptions to address Glama score issues
Address the following scoring dimensions flagged by Glama.ai: - Behavior: All tools now explicitly state 'Read-only' nature - Parameters: Every tool documents config, repo_path, config_path params - Completeness: Return value format (status + per-check results) described - Usage Guidelines: Each tool explains when to use vs sibling tools - Purpose: Retained clear verb+resource structure Tools updated: server_health, validate_commit_message, validate_branch_name, validate_author_info, validate_push_safety, validate_commit_context, validate_repository_state, describe_validation_rules
1 parent 1dc8fba commit 3f0c554

1 file changed

Lines changed: 77 additions & 8 deletions

File tree

src/commit_check_mcp/server.py

Lines changed: 77 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def _validate_all(
320320

321321
@mcp.tool()
322322
def server_health() -> dict[str, str]:
323-
"""Return server and dependency versions."""
323+
"""Return server and dependency versions. Read-only, no side effects. Returns dict with server name, server version, commit-check version, and MCP SDK version. Useful as a first call to verify the server is running and check version compatibility."""
324324
return {
325325
"server": "commit-check-mcp",
326326
"server_version": __version__,
@@ -336,7 +336,16 @@ def validate_commit_message(
336336
repo_path: str | None = None,
337337
config_path: str | None = None,
338338
) -> dict[str, Any]:
339-
"""Validate a commit message against commit-check rules."""
339+
"""Validate a commit message against commit-check rules. Read-only validation. Returns a structured result with overall status ('pass'/'fail') and a list of per-check results. Each check includes the check name, status, value, error message (on failure), and suggestion (on failure).
340+
341+
Use this tool when you have a specific commit message string to validate. For batch validation of message, branch, and author together, use validate_commit_context instead.
342+
343+
Parameters:
344+
- message (required): The commit message text to validate.
345+
- config (optional): Inline JSON config overrides on top of any loaded config file.
346+
- repo_path (optional): Path to the git repository for repo-relative config loading.
347+
- config_path (optional): Path to a custom commit-check TOML config file.
348+
"""
340349
if not isinstance(message, str) or not message.strip():
341350
raise ValueError("message must be a non-empty string")
342351
normalized_repo_path = _normalize_repo_path(repo_path)
@@ -355,7 +364,16 @@ def validate_branch_name(
355364
repo_path: str | None = None,
356365
config_path: str | None = None,
357366
) -> dict[str, Any]:
358-
"""Validate branch naming conventions with commit-check."""
367+
"""Validate branch naming conventions with commit-check. Read-only validation. Returns a structured result with overall status ('pass'/'fail') and per-check results (check name, status, value, error, suggest).
368+
369+
Use this when you need to verify a branch name follows configured convention rules (e.g., feature/*, bugfix/*). For combined message+branch+author validation, use validate_commit_context.
370+
371+
Parameters:
372+
- branch (optional): The branch name to validate. If omitted, detected from the current repo.
373+
- config (optional): Inline JSON config overrides.
374+
- repo_path (optional): Path to the git repository.
375+
- config_path (optional): Path to a custom commit-check TOML config file.
376+
"""
359377
normalized_branch = branch.strip() if isinstance(branch, str) else None
360378
if isinstance(branch, str) and not normalized_branch:
361379
raise ValueError("branch cannot be empty when provided")
@@ -376,7 +394,17 @@ def validate_author_info(
376394
repo_path: str | None = None,
377395
config_path: str | None = None,
378396
) -> dict[str, Any]:
379-
"""Validate commit author name and/or email with commit-check."""
397+
"""Validate commit author name and/or email with commit-check. Read-only validation. Returns a structured result with overall status and per-check results (check name, status, value, error, suggest).
398+
399+
Use this when you need to verify author metadata against configured rules (e.g., allowed email domains, name patterns). When both name and email are provided, both are validated. If neither is provided, both are checked against repo context. For combined validation, use validate_commit_context.
400+
401+
Parameters:
402+
- author_name (optional): The author name to validate.
403+
- author_email (optional): The author email to validate.
404+
- config (optional): Inline JSON config overrides.
405+
- repo_path (optional): Path to the git repository.
406+
- config_path (optional): Path to a custom commit-check TOML config file.
407+
"""
380408
normalized_name = author_name.strip() if isinstance(author_name, str) else None
381409
normalized_email = author_email.strip() if isinstance(author_email, str) else None
382410

@@ -402,7 +430,16 @@ def validate_push_safety(
402430
repo_path: str | None = None,
403431
config_path: str | None = None,
404432
) -> dict[str, Any]:
405-
"""Validate that a push is not a force push."""
433+
"""Validate that a push is not a force push. Read-only validation. Returns a structured result with overall status and per-check results (check name, status, value, error, suggest). By default, force push is rejected; configure via 'push.allow_force_push' in config.
434+
435+
Use this before performing a git push to ensure force-push protection rules are satisfied. Only validates the no_force_push rule. Use validate_commit_context for combined checks.
436+
437+
Parameters:
438+
- push_refs (optional): The push ref specification to validate. If omitted, checks upstream fallback state.
439+
- config (optional): Inline JSON config overrides.
440+
- repo_path (optional): Path to the git repository.
441+
- config_path (optional): Path to a custom commit-check TOML config file.
442+
"""
406443
normalized_push_refs = push_refs.strip() if isinstance(push_refs, str) else None
407444
normalized_repo_path = _normalize_repo_path(repo_path)
408445
return _validate_push(
@@ -423,7 +460,19 @@ def validate_commit_context(
423460
repo_path: str | None = None,
424461
config_path: str | None = None,
425462
) -> dict[str, Any]:
426-
"""Run combined commit-check validations in one call."""
463+
"""Run combined commit-check validations for message, branch, and/or author in one call. Read-only validation. Returns a structured result with overall status and a unified list of per-check results (check name, status, value, error, suggest).
464+
465+
Use this when you need to validate multiple commit aspects simultaneously in a single call. At least one of message, branch, author_name, or author_email must be provided. For individual aspects, use the specific validate_commit_message, validate_branch_name, or validate_author_info tools.
466+
467+
Parameters:
468+
- message (optional): Commit message text to validate.
469+
- branch (optional): Branch name to validate.
470+
- author_name (optional): Author name to validate.
471+
- author_email (optional): Author email to validate.
472+
- config (optional): Inline JSON config overrides on top of any loaded config file.
473+
- repo_path (optional): Path to the git repository for repo-relative config loading.
474+
- config_path (optional): Path to a custom commit-check TOML config file.
475+
"""
427476
normalized_message = message.strip() if isinstance(message, str) else None
428477
normalized_branch = branch.strip() if isinstance(branch, str) else None
429478
normalized_name = author_name.strip() if isinstance(author_name, str) else None
@@ -465,7 +514,19 @@ def validate_repository_state(
465514
include_author: bool = True,
466515
include_push: bool = False,
467516
) -> dict[str, Any]:
468-
"""Validate the latest commit, branch, author, and optional push safety state."""
517+
"""Validate the current repository state including latest commit message, active branch, author metadata, and optional push safety. Read-only validation. Reads git data (message, branch, author) from the local repository. Returns a structured result with overall status and per-check results.
518+
519+
Use this to validate the entire state of a local git repository in one call — ideal for pre-commit or CI hooks. Controls which checks run via boolean include_* flags. For validating arbitrary (non-repo) values, use validate_commit_context or individual validation tools instead.
520+
521+
Parameters:
522+
- repo_path (optional): Path to the git repository. If omitted, uses current working directory.
523+
- config (optional): Inline JSON config overrides on top of any loaded config file.
524+
- config_path (optional): Path to a custom commit-check TOML config file.
525+
- include_message (optional, default true): Whether to validate the latest commit message.
526+
- include_branch (optional, default true): Whether to validate the current branch name.
527+
- include_author (optional, default true): Whether to validate the latest commit author.
528+
- include_push (optional, default false): Whether to validate push safety.
529+
"""
469530
if not any([include_message, include_branch, include_author, include_push]):
470531
raise ValueError("At least one validation target must be enabled")
471532

@@ -524,7 +585,15 @@ def describe_validation_rules(
524585
repo_path: str | None = None,
525586
config_path: str | None = None,
526587
) -> dict[str, Any]:
527-
"""Return enabled commit-check rules after merging defaults, repo config, and overrides."""
588+
"""Return enabled commit-check rules after merging defaults, repo config, and inline overrides. Read-only, no side effects. Returns a dict with commit_check_version, the full merged config, supported check types, and enabled rules (each with check name, config, and pattern details).
589+
590+
Use this to inspect which validation rules are currently active before running any validation. Helps debug rule configuration and check which checks will be applied.
591+
592+
Parameters:
593+
- config (optional): Inline JSON config overrides on top of any loaded config file.
594+
- repo_path (optional): Path to the git repository for repo-relative config loading.
595+
- config_path (optional): Path to a custom commit-check TOML config file.
596+
"""
528597
normalized_repo_path = _normalize_repo_path(repo_path)
529598
normalized_config = _normalize_config(config)
530599
normalized_config_path = _normalize_config_path(config_path, normalized_repo_path)

0 commit comments

Comments
 (0)