mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-02 19:55:18 +02:00
fix linting issues with ruff
This commit is contained in:
parent
063c272b98
commit
0c3e25a07b
4 changed files with 20 additions and 20 deletions
|
|
@ -4,7 +4,6 @@ This module provides a client for communicating with MCP servers via stdio trans
|
|||
It handles server lifecycle management, tool discovery, and tool execution.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
from contextlib import asynccontextmanager
|
||||
|
|
@ -54,15 +53,17 @@ class MCPClient:
|
|||
)
|
||||
|
||||
# Spawn server process and create session
|
||||
async with stdio_client(server=server_params) as (read, write):
|
||||
async with ClientSession(read, write) as session:
|
||||
# Initialize the connection
|
||||
await session.initialize()
|
||||
self.session = session
|
||||
logger.info(
|
||||
f"Connected to MCP server: {self.command} {' '.join(self.args)}"
|
||||
)
|
||||
yield session
|
||||
async with (
|
||||
stdio_client(server=server_params) as (read, write),
|
||||
ClientSession(read, write) as session,
|
||||
):
|
||||
# Initialize the connection
|
||||
await session.initialize()
|
||||
self.session = session
|
||||
logger.info(
|
||||
f"Connected to MCP server: {self.command} {' '.join(self.args)}"
|
||||
)
|
||||
yield session
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to connect to MCP server: {e!s}", exc_info=True)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ def _normalize_gemini_params(params: dict[str, Any], mcp_schema: dict[str, Any])
|
|||
normalized_item[item_key] = item_value
|
||||
|
||||
# Add missing required fields with empty defaults if needed
|
||||
for required_field in items_properties.keys():
|
||||
for required_field in items_properties:
|
||||
if required_field not in normalized_item:
|
||||
# For arrays like observations, default to empty array
|
||||
if items_properties[required_field].get("type") == "array":
|
||||
|
|
@ -102,6 +102,7 @@ def _create_dynamic_input_model_from_schema(
|
|||
# Use Any type for complex schemas to preserve structure
|
||||
# This allows the MCP server to do its own validation
|
||||
from typing import Any as AnyType
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
if is_required:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue