Fix formatting issues in community environments - Applied black, isort, trailing whitespace, and end-of-file fixes - Remaining flake8 issues (unused imports, line length) noted for future cleanup

This commit is contained in:
Shannon Sands 2025-05-23 13:33:13 +10:00
parent e85a170c34
commit 7f2e1a4f90
34 changed files with 1560 additions and 821 deletions

View file

@ -73,4 +73,4 @@ To add a new MCP implementation:
git submodule add <repository-url> tools/mcp/<service-name>
```
2. Update this README.md file to include information about the new submodule
2. Update this README.md file to include information about the new submodule

View file

@ -1,18 +1,19 @@
from mcp.server.fastmcp import FastMCP
import logging
import os
from mcp.server.fastmcp import FastMCP
# Setup logging to a file
# Adjust the log file path if necessary, perhaps to be relative to this script's location
# or a dedicated logs directory.
log_file_path = os.path.join(os.path.dirname(__file__), 'math_server_official.log')
log_file_path = os.path.join(os.path.dirname(__file__), "math_server_official.log")
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
handlers=[
logging.FileHandler(log_file_path, mode='w'), # 'w' to overwrite each run
logging.StreamHandler()
]
logging.FileHandler(log_file_path, mode="w"), # 'w' to overwrite each run
logging.StreamHandler(),
],
)
logger = logging.getLogger(__name__)
@ -20,17 +21,21 @@ mcp = FastMCP("Official Math Server 🚀")
@mcp.tool()
def add(a: int, b: int) -> int: # Changed return type hint to int
def add(a: int, b: int) -> int: # Changed return type hint to int
"""Add two numbers and return the result"""
logger.info(f"Executing add tool with a={a}, b={b}")
return a + b
@mcp.tool()
def multiply(a: int, b: int) -> int: # Changed return type hint to int
def multiply(a: int, b: int) -> int: # Changed return type hint to int
"""Multiply two numbers and return the result"""
logger.info(f"Executing multiply tool with a={a}, b={b}")
return a * b
if __name__ == "__main__":
logger.info(f"Starting Official MCP math_server.py with STDIO transport... Log file: {log_file_path}")
mcp.run(transport="stdio") # Ensure stdio transport is used as in server_stdio.py
logger.info(
f"Starting Official MCP math_server.py with STDIO transport... Log file: {log_file_path}"
)
mcp.run(transport="stdio") # Ensure stdio transport is used as in server_stdio.py

View file

@ -22,4 +22,4 @@ WORKDIR /app
RUN npm ci --ignore-scripts --omit-dev
ENTRYPOINT ["node", "dist/index.js"]
ENTRYPOINT ["node", "dist/index.js"]

View file

@ -51,4 +51,4 @@ The integration is implemented in `agents/stone_agent.py` within the `delegate_t
## Testing
Tests for the Google Maps integration are available in `tests/ai/test_maps_integration.py`.
Tests for the Google Maps integration are available in `tests/ai/test_maps_integration.py`.

View file

@ -143,7 +143,7 @@ async function performChatCompletion(
model: model, // Model identifier passed as parameter
messages: messages,
// Additional parameters can be added here if required (e.g., max_tokens, temperature, etc.)
// See the Sonar API documentation for more details:
// See the Sonar API documentation for more details:
// https://docs.perplexity.ai/api-reference/chat-completions
};
@ -182,7 +182,7 @@ async function performChatCompletion(
throw new Error(`Failed to parse JSON response from Perplexity API: ${jsonError}`);
}
// Directly retrieve the main message content from the response
// Directly retrieve the main message content from the response
let messageContent = data.choices[0].message.content;
// If citations are provided, append them to the message content

View file

@ -7,7 +7,7 @@ A lightweight [Model Context Protocol (MCP)](https://modelcontextprotocol.io) se
<details>
<summary>Contents</summary>
- [Example Interactions](#example-interactions)
- [Tools](#tools)
- [Read Operations](#read-operations)